      def __getitem__(self, k):
          """
          Retrieves an item or slice from the set of results.
          """
          if not isinstance(k, (slice,) + six.integer_types):
              raise TypeError
          assert ((not isinstance(k, slice) and (k >= 0)) or
                  (isinstance(k, slice) and (k.start is None or k.start >= 0) and
                   (k.stop is None or k.stop >= 0))), \
              "Negative indexing is not supported."
 
</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         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 isinstance(srid, six.integer_types) or srid is None:
 </s> add         if isinstance(srid, int) or srid is None: </s> remove             if not value or not isinstance(value, string_types):
 </s> add             if not value or not isinstance(value, str): </s> remove         if isinstance(index, six.string_types):
 </s> add         if isinstance(index, str):
        if not isinstance(k, (int, slice)):
      def __getitem__(self, k):
          """
          Retrieves an item or slice from the set of results.
          """
        if not isinstance(k, (int, slice)):
              raise TypeError
          assert ((not isinstance(k, slice) and (k >= 0)) or
                  (isinstance(k, slice) and (k.start is None or k.start >= 0) and
                   (k.stop is None or k.stop >= 0))), \
              "Negative indexing is not supported."
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/db/models/query.py