python code for piranha project