              try:
                  mw_instance = middleware(handler)
              except MiddlewareNotUsed as exc:
                  if settings.DEBUG:
                      if six.text_type(exc):
                          logger.debug('MiddlewareNotUsed(%r): %s', middleware_path, exc)
                      else:
                          logger.debug('MiddlewareNotUsed: %r', middleware_path)
                  continue
  
 
</s> remove         if isinstance(file, six.string_types):
 </s> add         if isinstance(file, str): </s> remove         if isinstance(expected_data, six.string_types):
 </s> add         if isinstance(expected_data, str): </s> remove         if isinstance(expected_data, six.string_types):
 </s> add         if isinstance(expected_data, str): </s> remove             if not value or not isinstance(value, string_types):
 </s> add             if not value or not isinstance(value, str): </s> remove         if value and isinstance(value, six.string_types):
 </s> add         if value and isinstance(value, str):
                    if str(exc):
              try:
                  mw_instance = middleware(handler)
              except MiddlewareNotUsed as exc:
                  if settings.DEBUG:
                    if str(exc):
                          logger.debug('MiddlewareNotUsed(%r): %s', middleware_path, exc)
                      else:
                          logger.debug('MiddlewareNotUsed: %r', middleware_path)
                  continue
  
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/core/handlers/base.py