def __geometryToDict(self, geom):
        """converts a geometry object to a dictionary"""
        if isinstance(geom, dict):
            return geom
        elif isinstance(geom, Point):
            pt = geom.asDictionary
            return {"geometry": {"x" : pt['x'], "y" : pt['y']}}
        elif isinstance(geom, Polygon):
            poly = geom.asDictionary
            return {
                "geometry" : {
                    "rings" : poly['rings'],
                    'spatialReference' : poly['spatialReference']
                }
            }
        elif isinstance(geom, list):
            return [self.__geometryToDict(g) for g in geom]
def __geometryToDict ( self , geom ) : if isinstance ( geom , dict ) : return geom elif isinstance ( geom , Point ) : pt = geom . asDictionary return { "geometry" : { "x" : pt [ 'x' ] , "y" : pt [ 'y' ] } } elif isinstance ( geom , Polygon ) : poly = geom . asDictionary return { "geometry" : { "rings" : poly [ 'rings' ] , 'spatialReference' : poly [ 'spatialReference' ] } } elif isinstance ( geom , list ) : return [ self . __geometryToDict ( g ) for g in geom ]
converts a geometry object to a dictionary