added another pyhton implementation