def translate_to_per_unit(x, nominal_unit, z_base):
    """Translate parameters in nominal units to per-unit values.

    :param int/float x: value to be converted.
    :param str nominal_unit: the units of ``x``.
    :param int/float z_base: base impedance (can be calculated with
        :func:`calculate_z_base').
    :return: (*float*) -- per-unit value.
    :raises ValueError: if the nominal unit isn't recognized.
    """
    if nominal_unit.lower() in {"ohm", "ohms", "r", "x"}:
        return x / z_base
    if nominal_unit.lower() in {"siemen", "siemens"}:
        return x * z_base
    raise ValueError(f"Unknown nominal unit: {nominal_unit}")