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