def function_repr(func):
    methname = func.func_name
    # formal names
    argcount = func.func_code.co_argcount
    varnames = list(func.func_code.co_varnames)[:argcount]
    if func.func_defaults:
        ld = len(func.func_defaults)
        varlist = varnames[:-ld]
        varlist.extend(["%s=%r" % (n, v) for n, v in zip(varnames[-ld:], func.func_defaults)])
        return "%s(%s)" % (methname, ", ".join(varlist))
    else:
        return "%s(%s)" % (methname, ", ".join(varnames))
dataset/ETHPy150Open kdart/pycopia/CLI/pycopia/UI.py/function_repr/original