          if hasattr(backend_op, 'check_relate_argument'):
              backend_op.check_relate_argument(value[1])
          else:
              pattern = value[1]
              if not isinstance(pattern, six.string_types) or not self.pattern_regex.match(pattern):
                  raise ValueError('Invalid intersection matrix pattern "%s".' % pattern)
          return super(RelateLookup, self).get_db_prep_lookup(value, connection)
  
  
  gis_lookups['relate'] = RelateLookup
 
</s> remove         if not isinstance(pattern, six.string_types) or len(pattern) > 9:
 </s> add         if not isinstance(pattern, str) or len(pattern) > 9: </s> remove         if not isinstance(arg, six.string_types) or not mask_regex.match(arg):
 </s> add         if not isinstance(arg, str) or not mask_regex.match(arg): </s> remove     def test_reverse_returns_unicode(self):
        name, expected, args, kwargs = test_data[0]
        self.assertIsInstance(
            reverse(name, args=args, kwargs=kwargs),
            six.text_type
        )

 </s> add  </s> remove     if isinstance(result, six.integer_types):
 </s> add     if isinstance(result, int): </s> remove         rel_is_string = isinstance(self.remote_field.model, six.string_types)
 </s> add         rel_is_string = isinstance(self.remote_field.model, str)
            if not isinstance(pattern, str) or not self.pattern_regex.match(pattern):
          if hasattr(backend_op, 'check_relate_argument'):
              backend_op.check_relate_argument(value[1])
          else:
              pattern = value[1]
            if not isinstance(pattern, str) or not self.pattern_regex.match(pattern):
                  raise ValueError('Invalid intersection matrix pattern "%s".' % pattern)
          return super(RelateLookup, self).get_db_prep_lookup(value, connection)
  
  
  gis_lookups['relate'] = RelateLookup
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/models/lookups.py