  def check_geom(result, func, cargs):
      "Checks a function that returns a geometry."
      # OGR_G_Clone may return an integer, even though the
      # restype is set to c_void_p
      if isinstance(result, six.integer_types):
          result = c_void_p(result)
      if not result:
          raise GDALException('Invalid geometry pointer returned from "%s".' % func.__name__)
      return result
  
 
</s> remove     if isinstance(result, six.integer_types):
 </s> add     if isinstance(result, int): </s> remove     if isinstance(result, six.integer_types):
 </s> add     if isinstance(result, int): </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         if not isinstance(index, (slice,) + six.integer_types):
 </s> add         if not isinstance(index, (int, slice)): </s> remove         return six.text_type("QUERY = %r - PARAMS = %r") % (sql, u_params)
 </s> add         return "QUERY = %r - PARAMS = %r" % (sql, u_params)
    if isinstance(result, int):
  def check_geom(result, func, cargs):
      "Checks a function that returns a geometry."
      # OGR_G_Clone may return an integer, even though the
      # restype is set to c_void_p
    if isinstance(result, int):
          result = c_void_p(result)
      if not result:
          raise GDALException('Invalid geometry pointer returned from "%s".' % func.__name__)
      return result
  
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/prototypes/errcheck.py