def _get_option_of_highest_precedence(config, option_name):
    """looks in the config and returns the option of the highest precedence
    This assumes that there are options and flags that are equivalent

    Args:
        config (_pytest.config.Config): The pytest config object
        option_name (str): The name of the option

    Returns:
        str: The value of the option that is of highest precedence
        None: no value is present
    """

    #  Try to get configs from CLI and ini
    try:
        cli_option = config.getoption("--{}".format(option_name))
    except ValueError:
        cli_option = None
    try:
        ini_option = config.getini(option_name)
    except ValueError:
        ini_option = None

    highest_precedence = cli_option or ini_option
    return highest_precedence