code: def remove_handlers(logger):
      # TODO: Issue related to placeholder logger objects appearing in some rare cases. Check below
      # required as a workaround
      
      if hasattr(logger, "handlers"):
          for handler in logger.handlers[::-1]:
              try:
                  if isinstance(handler, logging.FileHandler):
                      handler.close()
                  logger.removeHandler(handler)
              except:  # pylint: disable=bare-except
                  import traceback
                  traceback.print_exc()
                  break
docs: Remove handlers from logger.
  
      :param logger: Logger whose handlers to remove