P4 in Python