def METHOD_NAME(cls, api_values: dict[str, str] | None, values) -> dict[str, str] | None:
    """Check that if the parameter has API values it also has values."""
    if api_values and not values.get("values"):
        msg = f"Parameter {values['name']} has api_values but no values"
        raise ValueError(msg)
    if api_values and not set(api_values.keys()).issubset(set(values.get("values", []))):
        msg = f"Parameter {values['name']} has api_values keys that are not listed in values"
        raise ValueError(msg)
    return api_values