rewrite lish in python