def tex_encode(name):
    m = re.match(r"^(.+)i\[([0-9]+)\]$", name)
    if m != None:
        return r"{%s}_{%s}" % (tex_encode(m.group(1)), m.group(2))

    m = re.match(r"^(.+)_prime$", name)
    if m != None:
        return (tex_encode(m.group(1))) % r"{%s'}"   

    m = re.match(r"^(.+)_bar$", name)
    if m != None:
        return r"{\overline{%s}}" % (tex_encode(m.group(1)))

    return name
dataset/ETHPy150Open gdanezis/petlib/examples/genzkp.py/tex_encode/swapped operands of `%`