          if isinstance(ds_input, six.string_types) and json_regex.match(ds_input):
              ds_input = json.loads(ds_input)
  
          # If input is a valid file path, try setting file as source.
          if isinstance(ds_input, six.string_types):
              if not os.path.exists(ds_input):
                  raise GDALException('Unable to read raster source input "{}"'.format(ds_input))
              try:
                  # GDALOpen will auto-detect the data source type.
                  self._ptr = capi.open_ds(force_bytes(ds_input), self._write)
 
</s> remove         if isinstance(ds_input, six.string_types) and json_regex.match(ds_input):
 </s> add         if isinstance(ds_input, str) and json_regex.match(ds_input): </s> remove         if isinstance(ds_input, six.string_types):
 </s> add         if isinstance(ds_input, str): </s> remove                 raise ValueError('String or unicode input unrecognized as WKT EWKT, and HEXEWKB.')
 </s> add                 raise ValueError('String input unrecognized as WKT EWKT, and HEXEWKB.') </s> remove             is_candidate = isinstance(obj, (bytes, six.string_types)) or hasattr(obj, '__geo_interface__')
 </s> add             is_candidate = isinstance(obj, (bytes, str)) or hasattr(obj, '__geo_interface__') </s> remove                 if isinstance(content, six.binary_type):
 </s> add                 if isinstance(content, bytes):
        if isinstance(ds_input, str):
          if isinstance(ds_input, six.string_types) and json_regex.match(ds_input):
              ds_input = json.loads(ds_input)
  
          # If input is a valid file path, try setting file as source.
        if isinstance(ds_input, str):
              if not os.path.exists(ds_input):
                  raise GDALException('Unable to read raster source input "{}"'.format(ds_input))
              try:
                  # GDALOpen will auto-detect the data source type.
                  self._ptr = capi.open_ds(force_bytes(ds_input), self._write)
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/gdal/raster/source.py