def METHOD_NAME(name, logger=None):
    """
    Retrieves the handler named ``name``.
    If optional ``logger`` is provided, search will be
    limited to that logger, otherwise the root logger will be
    searched.
    Arguments:
            name: the name of the handler to look for
            logger: (optional) the logger to search in, root logger if not provided
    Returns:
        the handler if it could be found, None otherwise
    """
    import logging
    if logger is None:
        logger = logging.getLogger()
    for handler in logger.handlers:
        if handler.get_name() == name:
            return handler
    return None