          """
          # Get the srid for this object
          if value is None:
              value_srid = None
          elif f.geom_type == 'RASTER' and isinstance(value, six.string_types):
              value_srid = get_pgraster_srid(value)
          else:
              value_srid = value.srid
  
          # Adding Transform() to the SQL placeholder if the value srid
 
</s> remove         elif f.geom_type == 'RASTER' and isinstance(value, six.string_types):
 </s> add         elif f.geom_type == 'RASTER' and isinstance(value, str): </s> remove         elif value is None or isinstance(value, six.string_types + (six.memoryview,)):
 </s> add         elif value is None or isinstance(value, (str, memoryview)): </s> remove         if value and isinstance(value, six.string_types):
 </s> add         if value and isinstance(value, str): </s> remove         if gtype == 'RASTER' and (value is None or isinstance(value, six.string_types + (dict, self._klass))):
 </s> add         if gtype == 'RASTER' and (value is None or isinstance(value, (str, dict, self._klass))): </s> remove         if isinstance(srid, six.integer_types) or srid is None:
 </s> add         if isinstance(srid, int) or srid is None:
        elif f.geom_type == 'RASTER' and isinstance(value, str):
          """
          # Get the srid for this object
          if value is None:
              value_srid = None
        elif f.geom_type == 'RASTER' and isinstance(value, str):
              value_srid = get_pgraster_srid(value)
          else:
              value_srid = value.srid
  
          # Adding Transform() to the SQL placeholder if the value srid
keep keep keep keep replace keep keep keep keep keep
 Refs #23919 -- Removed six.<various>_types usage

Thanks Tim Graham and Simon Charette for the reviews. 
django/contrib/gis/db/backends/postgis/operations.py