def _pytest_get_option(config, name, default):
    """Get pytest options in a version independent way, with allowed defaults."""

    try:
        value = config.getoption(name, default=default)
    except Exception:
        try:
            value = config.getvalue(name)
        except Exception:
            return default
    return value