Python transform file