<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reprsig(fun, name=None, method=False):
 """Format a methods signature for display."""

    args, varargs, keywords, defs, kwargs = [], [], None, [], {}
    argspec = fun
    if callable(fun):
        name = fun.__name__ if name is None else name
        argspec = getargspec(fun)
    try:
        args = argspec[0]
        varargs = argspec[1]
        keywords = argspec[2]
        defs = argspec[3]
    except IndexError:
        pass
    if defs:
        args, kwkeys = args[:-len(defs)], args[-len(defs):]
        kwargs = dict(zip(kwkeys, defs))
    if varargs:
        args.append('*' + varargs)
    if method:
        args.insert(0, 'self')
    return reprcall(name, map(str, args), kwargs, keywords,
                    argfilter=str)