def global_value(config, default):
    """
    Find the global value for PermitRootLogin option in sshd_config.

    OpenSSH is using the first value found in configuration file, that is not
    in match block other than "all". If there is no such option, the argument
    "default" will be returned.
    """
    for opt in config.permit_root_login:
        if (opt.in_match is None or opt.in_match[0].lower() == 'all'):
            return opt.value
    return default