def parse_spec(text):
    """ Parse string with partition specification. """
    tokens = text.split(",")
    specs = []
    for token in tokens:
        if not token in ":":
            token += ":1"

        (sizespec, weight) = token.split(':')
        weight = float(weight) # throws exception with reasonable error string

        units = {"m": 1, "g": 1 << 10, "t": 1 << 20, "p": 1 << 30}
        unit = units.get(sizespec[-1].lower(), None)
        if not unit:
            # there is no unit specifier, it must be just the number
            size = float(sizespec)
            unit = 1
        else:
            size = float(sizespec[:-1])
        spec = PartitionSpec(int(size * unit), weight)
        specs.append(spec)
    return specs
dataset/ETHPy150Open openshift/openshift-ansible/roles/kube_nfs_volumes/library/partitionpool.py/parse_spec/swapped operands of `in`