old_contents: import sys
  import datetime
  
  
  def import_string(import_name):
      import_name = str(import_name).replace(':', '.')
      try:
          __import__(import_name)
      except ImportError:
          if '.' not in import_name:
              raise
      else:
          return sys.modules[import_name]
  
      module_name, obj_name = import_name.rsplit('.', 1)
      module = __import__(module_name, None, None, [obj_name])
      try:
          return getattr(module, obj_name)
      except AttributeError as e:
          raise ImportError(e)
  
  
  class cached_property:
      def __init__(self, func, name=None):
          self.func = func
          self.__doc__ = getattr(func, '__doc__')
          self.name = name or func.__name__
  
      def __get__(self, instance, cls=None):
          if instance is None:
              return self
          res = instance.__dict__[self.name] = self.func(instance)
          return res
  
  
  class Singleton(type):
      _instances = {}
  
      def __call__(cls, *args, **kwargs):
          if cls not in cls._instances:
              cls._instances[cls] = super(
                  Singleton, cls).__call__(*args, **kwargs)
          return cls._instances[cls]
  
  
  def logger_has_level_handler(logger):
      """Check if there is a handler in the logging chain that will handle the
      given logger's :meth:`effective level <~logging.Logger.getEffectiveLevel>`.
      """
      level = logger.getEffectiveLevel()
      current = logger
  
      while current:
          if any(handler.level <= level for handler in current.handlers):
              return True
  
          if not current.propagate:
              break
  
          current = current.parent
  
      return False
  
new_contents: import sys
  
  
  def import_string(import_name):
      import_name = str(import_name).replace(':', '.')
      try:
          __import__(import_name)
      except ImportError:
          if '.' not in import_name:
              raise
      else:
          return sys.modules[import_name]
  
      module_name, obj_name = import_name.rsplit('.', 1)
      module = __import__(module_name, None, None, [obj_name])
      try:
          return getattr(module, obj_name)
      except AttributeError as e:
          raise ImportError(e)
  
  
  class cached_property:
      def __init__(self, func, name=None):
          self.func = func
          self.__doc__ = getattr(func, '__doc__')
          self.name = name or func.__name__
  
      def __get__(self, instance, cls=None):
          if instance is None:
              return self
          res = instance.__dict__[self.name] = self.func(instance)
          return res
  
  
  class Singleton(type):
      _instances = {}
  
      def __call__(cls, *args, **kwargs):
          if cls not in cls._instances:
              cls._instances[cls] = super(
                  Singleton, cls).__call__(*args, **kwargs)
          return cls._instances[cls]
  
  
  def logger_has_level_handler(logger):
      """Check if there is a handler in the logging chain that will handle the
      given logger's :meth:`effective level <~logging.Logger.getEffectiveLevel>`.
      """
      level = logger.getEffectiveLevel()
      current = logger
  
      while current:
          if any(handler.level <= level for handler in current.handlers):
              return True
  
          if not current.propagate:
              break
  
          current = current.parent
  
      return False
  
subject: fix flake8