          return backend, location, args
      else:
          try:
              # Trying to import the given backend, in case it's a dotted path
              backend_cls = import_by_path(backend)
          except ImproperlyConfigured as e:
              raise InvalidCacheBackendError("Could not find backend '%s': %s" % (
                  backend, e))
          location = kwargs.pop('LOCATION', '')
          return backend, location, kwargs
 
</s> remove                 except ImproperlyConfigured as e:
 </s> add                 except ImproperlyConfigured: </s> remove             from django.conf import settings
 </s> add  </s> remove         except ValidationError:
 </s> add         except forms.ValidationError: </s> remove from django.utils import six
 </s> add  </s> remove         match = None
 </s> add 
            import_by_path(backend)
          return backend, location, args
      else:
          try:
              # Trying to import the given backend, in case it's a dotted path
            import_by_path(backend)
          except ImproperlyConfigured as e:
              raise InvalidCacheBackendError("Could not find backend '%s': %s" % (
                  backend, e))
          location = kwargs.pop('LOCATION', '')
          return backend, location, kwargs
keep keep keep keep replace keep keep keep keep keep
 Fixed a number of flake8 errors -- particularly around unused imports and local variables 
django/core/cache/__init__.py