def METHOD_NAME(logger):
  """Find a StreamHandler that is attached to the logger that prints to the console."""
  for handler in logger.handlers:
    if isinstance(handler, logging.StreamHandler) and handler.stream in (sys.stderr, sys.stdout):
      return logger
  return None