  
      def finalize(self):
          def rstrip_last_element(children):
              if children:
                  if isinstance(children[-1], six.string_types):
                      children[-1] = children[-1].rstrip()
                      if not children[-1]:
                          children.pop()
                          children = rstrip_last_element(children)
              return children
 
</s> remove             if isinstance(child, six.string_types):
 </s> add             if isinstance(child, str): </s> remove                 if isinstance(self.children[-1], six.string_types):
 </s> add                 if isinstance(self.children[-1], str): </s> remove         if not isinstance(string_if_invalid, six.string_types):
 </s> add         if not isinstance(string_if_invalid, str): </s> remove             if isinstance(self.children[-1], six.string_types):
 </s> add             if isinstance(self.children[-1], str): </s> remove         if not isinstance(document.children[0], six.string_types):
 </s> add         if not isinstance(document.children[0], str):
                if isinstance(children[-1], str):
  
      def finalize(self):
          def rstrip_last_element(children):
              if children:
                if isinstance(children[-1], str):
                      children[-1] = children[-1].rstrip()
                      if not children[-1]:
                          children.pop()
                          children = rstrip_last_element(children)
              return children
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/html.py