      if isinstance(s, Promise):
          return six.text_type(s).encode(encoding, errors)
      if not isinstance(s, six.string_types):
          try:
              return six.text_type(s).encode(encoding)
          except UnicodeEncodeError:
              if isinstance(s, Exception):
                  # An Exception subclass containing non-ASCII data that doesn't
                  # know how to print itself properly. We shouldn't raise a
                  # further exception.
 
</s> remove         return six.text_type(s).encode(encoding, errors)
    if not isinstance(s, six.string_types):
 </s> add         return str(s).encode(encoding, errors)
    if not isinstance(s, str): </s> remove             return six.text_type(s).encode(encoding, errors)
 </s> add             return str(s).encode(encoding, errors) </s> remove     if isinstance(s, six.memoryview):
 </s> add     if isinstance(s, memoryview): </s> remove             # Note: We use .decode() here, instead of six.text_type(s, encoding,
 </s> add             # Note: We use .decode() here, instead of str(s, encoding, </s> remove                 s = six.text_type(s, encoding, errors)
 </s> add                 s = str(s, encoding, errors)
            return str(s).encode(encoding)
      if isinstance(s, Promise):
          return six.text_type(s).encode(encoding, errors)
      if not isinstance(s, six.string_types):
          try:
            return str(s).encode(encoding)
          except UnicodeEncodeError:
              if isinstance(s, Exception):
                  # An Exception subclass containing non-ASCII data that doesn't
                  # know how to print itself properly. We shouldn't raise a
                  # further exception.
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/utils/encoding.py