def single_pulse_SCPI(
    pulsewidth, updown, high_voltage, low_voltage, channel="1", *args, **kwargs
):
    """
    Returns SCPI string that can be written to the pulse generator to put it in the correct state to apply a single pulse.

    args:
            pulsewidth (str): Pulsewidth. i.e. '10ns' allowed units {ns, us, ms, s}
            updown (str): Specify polarity. 'up' or 'down'.
            high_voltage (str): High voltage of pulse. i.e. '1000mv' allowed units {V, mv}
            low_voltage (str): Low voltage of pulse. i.e. '-1000mv' allowed units {V, mv}
            channel (str): Specify the output channel. '1' or '2'


    """
    if pulsewidth[-2:] not in set(
        {
            "ns",
            "us",
            "ms",
        }
    ):
        if pulsewidth[-1] != "s":
            raise ValueError("pulsewidth " + str(pulsewidth) + " not supported")
    if updown not in set({"up", "down"}):
        raise ValueError("updown " + str(updown) + " not supported")
    if high_voltage[-2:].lower() not in set({"mv"}):
        if high_voltage[-1].lower() != "v":
            raise ValueError("high_voltage " + str(high_voltage) + " not supported")
    if low_voltage[-2:].lower() not in set({"mv"}):
        if low_voltage[-1].lower() != "v":
            raise ValueError("low_voltage " + str(low_voltage) + " not supported")
    if channel not in set({"1", "2"}):
        raise ValueError("channel " + str(channel) + " not supported")

    if updown == "up":
        out = "outp" + channel + ":puls:mode sin;"
        out += ":sour" + channel + ":inv off;"
        out += ":sour" + channel + ":volt:lev:imm:high " + high_voltage + ";"
        out += ":sour" + channel + ":volt:lev:imm:low " + low_voltage + ";"
        # puls1 means the first pulse because we are in single mode
        out += ":sour" + channel + ":puls1:wid " + pulsewidth + ";"
        return out
    else:
        out = "outp" + channel + ":puls:mode sin;"
        out += ":sour" + channel + ":inv on;"
        out += ":sour" + channel + ":volt:lev:imm:low " + low_voltage + ";"
        out += ":sour" + channel + ":volt:lev:imm:high " + high_voltage + ";"
        # puls1 means the first pulse because we are in single mode
        out += ":sour" + channel + ":puls1:wid " + pulsewidth + ";"
        return out