code: def geometry_type(layer):
      
      if is_raster_layer(layer):
          return layer_geometry_raster['key']
      elif is_point_layer(layer):
          return layer_geometry_point['key']
      elif is_line_layer(layer):
          return layer_geometry_line['key']
      elif is_polygon_layer(layer):
          return layer_geometry_polygon['key']
      else:
          return None
docs: Retrieve the geometry type: point, line, polygon or raster for a layer.
  
      :param layer: The layer.
      :type layer: QgsMapLayer
  
      :return: The definition key.
      :rtype: basestring