def METHOD_NAME(logger, handler, level, msg, exc_info=None, extra=None, *args):
    """
    Logs to the provided handler only.
    Arguments:
            logger: logger to log to
            handler: handler to restrict logging to
            level: level to log at
            msg: message to log
            exc_info: optional exception info
            extra: optional extra data
            *args: log args
    """
    import sys
    try:
        from logging import _srcfile
    except ImportError:
        _srcfile = None
    # this is just the same as logging.Logger._log
    if _srcfile:
        # IronPython doesn't track Python frames, so findCaller raises an
        # exception on some versions of IronPython. We trap it here so that
        # IronPython can use logging.
        try:
            fn, lno, func = logger.findCaller()
        except ValueError:
            fn, lno, func = "(unknown file)", 0, "(unknown function)"
    else:
        fn, lno, func = "(unknown file)", 0, "(unknown function)"
    if exc_info:
        if not isinstance(exc_info, tuple):
            exc_info = sys.exc_info()
    record = logger.makeRecord(
        logger.name, level, fn, lno, msg, args, exc_info, func, extra
    )
    # and this is a mixture of logging.Logger.handle and logging.Logger.callHandlers
    if (not logger.disabled) and logger.filter(record):
        if record.levelno >= handler.level:
            handler.handle(record)