A direct translation of shimmie to python