Did #44 in python