Create Cleanup Policies with Python

Does anyone have an example python script to create a cleanup policy and associate with with a repo? We do not want to use groovy since it si not natively installed on our servers.