def def_init(imports, attributes):
    indent = INDENT+INDENT
    indent3 = INDENT+INDENT+INDENT
    line = ["%sdef __init__(self," % INDENT]

    for elem in attributes:
        if elem[0] in PROTECTED_KEYWORDS:
            _name = elem[0] +"_"
        else:
            _name = elem[0]

        if elem[2]:
            line.append("%s%s='%s'," % (indent3, _name, elem[2]))
        else:
            line.append("%s%s=%s," % (indent3, _name, elem[2]))

    for _, elems in imports.items():
        for elem in elems:
            if elem in PROTECTED_KEYWORDS:
                _name = elem +"_"
            else:
                _name = elem
            line.append("%s%s=None," % (indent3, _name))

    line.append("%stext=None," % indent3)
    line.append("%sextension_elements=None," % indent3)
    line.append("%sextension_attributes=None," % indent3)
    line.append("%s):" % indent)
    return line
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/tools/parse_xsd2.py/def_init/original