def METHOD_NAME(raw: Union[float, int]) -> int:
    if isinstance(raw, float):
        if not raw.is_integer():
            # The values are in hertz, and everything should be a whole number.
            raise ValueError(f"Unexpected non-integer frequency: {raw}")
        return int(raw)
    else:
        return raw