code: def layer(self, queryset, stylename=None):
          
          cls = RasterLayer if hasattr(queryset, 'image') else VectorLayer
          layer = cls(queryset, style=stylename)
          try:
              style = self.map.find_style(layer.stylename)
          except KeyError:
              self.map.append_style(layer.stylename, layer.style())
          layer.styles.append(layer.stylename)
          self.map.layers.append(layer._layer)
          return layer
docs: Returns a map Layer.
  
          Arguments:
          queryset -- QuerySet for Layer
          Keyword args:
          stylename -- str name of style to apply