<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_operations(ops_string):
 """Takes a string of operations written with a handy DSL "OPERATION-NAME BANDS ARG1 ARG2 OPERATION-NAME BANDS ARG" And returns a list of functions, each of which take and return ndarrays """

    band_lookup = {"r": 1, "g": 2, "b": 3}
    count = len(band_lookup)

    opfuncs = {"saturation": saturation, "sigmoidal": sigmoidal, "gamma": gamma}

    opkwargs = {
        "saturation": ("proportion",),
        "sigmoidal": ("contrast", "bias"),
        "gamma": ("g",),
    }

    # Operations that assume RGB colorspace
    rgb_ops = ("saturation",)

    # split into tokens, commas are optional whitespace
    tokens = [x.strip() for x in ops_string.replace(",", "").split(" ")]
    operations = []
    current = []
    for token in tokens:
        if token.lower() in opfuncs.keys():
            if len(current) > 0:
                operations.append(current)
                current = []
        current.append(token.lower())
    if len(current) > 0:
        operations.append(current)

    result = []
    for parts in operations:
        opname = parts[0]
        bandstr = parts[1]
        args = parts[2:]

        try:
            func = opfuncs[opname]
        except KeyError:
            raise ValueError("{} is not a valid operation".format(opname))

        if opname in rgb_ops:
            # ignore bands, assumed to be in rgb
            # push 2nd arg into args
            args = [bandstr] + args
            bands = (1, 2, 3)
        else:
            # 2nd arg is bands
            # parse r,g,b ~= 1,2,3
            bands = set()
            for bs in bandstr:
                try:
                    band = int(bs)
                except ValueError:
                    band = band_lookup[bs.lower()]
                if band < 1 or band > count:
                    raise ValueError(
                        "{} BAND must be between 1 and {}".format(opname, count)
                    )
                bands.add(band)

        # assume all args are float
        args = [float(arg) for arg in args]
        kwargs = dict(zip(opkwargs[opname], args))

        # Create opperation function
        f = _op_factory(
            func=func,
            kwargs=kwargs,
            opname=opname,
            bands=bands,
            rgb_op=(opname in rgb_ops),
        )
        result.append(f)

    return result