If you are trying to author Rules using the WF rule engine than 2 samples are must for reference . These are old samples but works like charm :
Samples :
External ruleset toolkit
Ruleset analyzer
Here you go published a python code sample written for migrating S3 bucket ownership controls between AWS accounts. The code is written to ...