import logging


def query_stream_log_handler(logger):
    """Query stream handler from logger."""
    if len(logger.handlers):
        ch = logger.handlers[0]
    else:
        ch = logging.StreamHandler()
        logger.addHandler(ch)
    return ch