import logging


def get_null_logger() -> logging.Logger:
    """
    Get a logger that does nothing.
    Useful for writing library functions where logging is optional.

    :return:
    """
    logger = logging.getLogger('_null')
    if len(logger.handlers) == 0:
        logger.addHandler(logging.NullHandler())
    logger.setLevel(logging.CRITICAL)

    return logger