          try:
              data = json.loads(raw)
          except ValueError:
              self.fail("First argument is not valid JSON: %r" % raw)
          if isinstance(expected_data, six.string_types):
              try:
                  expected_data = json.loads(expected_data)
              except ValueError:
                  self.fail("Second argument is not valid JSON: %r" % expected_data)
          self.assertEqual(data, expected_data, msg=msg)
 
</s> remove         if isinstance(expected_data, six.string_types):
 </s> add         if isinstance(expected_data, str): </s> remove                 '"%s" is not a valid regular expression: %s' %
                (regex, six.text_type(e))
 </s> add                 '"%s" is not a valid regular expression: %s' % (regex, e) </s> remove             assert isinstance(to, six.string_types), (
 </s> add             assert isinstance(to, str), ( </s> remove         elif isinstance(srs_input, six.integer_types):
 </s> add         elif isinstance(srs_input, int): </s> remove         if isinstance(ds_input, six.string_types):
 </s> add         if isinstance(ds_input, str):
        if isinstance(expected_data, str):
          try:
              data = json.loads(raw)
          except ValueError:
              self.fail("First argument is not valid JSON: %r" % raw)
        if isinstance(expected_data, str):
              try:
                  expected_data = json.loads(expected_data)
              except ValueError:
                  self.fail("Second argument is not valid JSON: %r" % expected_data)
          self.assertEqual(data, expected_data, msg=msg)
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/test/testcases.py