def METHOD_NAME(text):
    """
    Mangle the special characters in the given string as _XY where XY
    is the ASCII code encoded in base64.
    Reimplementation of mangle() in deal.II's parameter_handler.cc
    """
    output = ""
    lookup = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']
    for t in text:
        if (t >= 'a' and t <= 'z') or (t>= 'A' and t <= 'Z') or (t>= '0' and t <= '9'):
            output += t
        else:
            output += '_'
            c = ord(t)
            assert(c<256)
            output += lookup[c // 16]
            output += lookup[c % 16]
    return output