def ensure_geometry(geom):
 if (not hasattr(geom, u'geom_type')):
  raise SpatialError((u"Point '%s' doesn't appear to be a GEOS geometry." % geom))
 return geom

def ensure_geometry ( geom ) : if ( not hasattr ( geom , u'geom_type' ) ) : raise SpatialError ( ( u"Point '%s' doesn't appear to be a GEOS geometry." % geom ) ) return geom
makes sure the parameter passed in looks like a geos geosgeometry .