  
      def check_relate_argument(self, arg):
          masks = 'TOUCH|OVERLAPBDYDISJOINT|OVERLAPBDYINTERSECT|EQUAL|INSIDE|COVEREDBY|CONTAINS|COVERS|ANYINTERACT|ON'
          mask_regex = re.compile(r'^(%s)(\+(%s))*$' % (masks, masks), re.I)
          if not isinstance(arg, six.string_types) or not mask_regex.match(arg):
              raise ValueError('Invalid SDO_RELATE mask: "%s"' % arg)
  
      def as_sql(self, connection, lookup, template_params, sql_params):
          template_params['mask'] = sql_params.pop()
          return super(SDORelate, self).as_sql(connection, lookup, template_params, sql_params)
 
</s> remove             if not isinstance(pattern, six.string_types) or not self.pattern_regex.match(pattern):
 </s> add             if not isinstance(pattern, str) or not self.pattern_regex.match(pattern): </s> remove                 not isinstance(self.remote_field.model, six.string_types) and
 </s> add                 not isinstance(self.remote_field.model, str) and </s> remove     if not isinstance(lookup_view, six.string_types):
 </s> add     if not isinstance(lookup_view, str): </s> remove         rel_is_string = isinstance(self.remote_field.model, six.string_types)
 </s> add         rel_is_string = isinstance(self.remote_field.model, str) </s> remove     if isinstance(result, six.integer_types):
 </s> add     if isinstance(result, int):
        if not isinstance(arg, str) or not mask_regex.match(arg):
  
      def check_relate_argument(self, arg):
          masks = 'TOUCH|OVERLAPBDYDISJOINT|OVERLAPBDYINTERSECT|EQUAL|INSIDE|COVEREDBY|CONTAINS|COVERS|ANYINTERACT|ON'
          mask_regex = re.compile(r'^(%s)(\+(%s))*$' % (masks, masks), re.I)
        if not isinstance(arg, str) or not mask_regex.match(arg):
              raise ValueError('Invalid SDO_RELATE mask: "%s"' % arg)
  
      def as_sql(self, connection, lookup, template_params, sql_params):
          template_params['mask'] = sql_params.pop()
          return super(SDORelate, self).as_sql(connection, lookup, template_params, sql_params)
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/oracle/operations.py