def decode_message(message, decoder):
    out = []
    objects = []
    mapping = {}
    in_field = False
    prev = 0
    for index, ch in enumerate(message):
        if not in_field:
            if ch == "{":
                in_field = True
                if prev != index:
                    out.append(message[prev:index])
                prev = index
            elif ch == "}":
                raise FormatException("unmatched }")
        elif in_field:
            if ch == "{":
                raise FormatException("{ inside {}")
            elif ch == "}":
                in_field = False
                obj, msgid = decoder(message[prev+1:index])
                if msgid is None:
                    objects.append(obj)
                    out.append("%s")
                else:
                    mapping[msgid] = obj
                    out.append("%("+msgid+")s")
                prev = index + 1
    if in_field:
        raise FormatException("unmatched {")
    if index <= prev:
        out.append(message[prev:index+1])
    result = "".join(out)
    if mapping:
        args = mapping
    else:
        args = tuple(objects)
    return ugettext(result) % args
dataset/ETHPy150Open brosner/django-notification/notification/message.py/decode_message/swapped operands of `<=`