def mangle(name):
    """Mangle a name according to the ABI"""
    namespaces = name.split("::")
    mangled_name = ""
    for namespace in namespaces:
        mangled_name += str(len(namespace)) + namespace
    if len(namespaces) > 1:
        mangled_name = "N" + mangled_name + "E"
    return mangled_name