code: 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]
docs: converts a geometry object to a dictionary