Little bit of python magic