code: def reprsig(fun, name=None, method=False):
      
      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)
docs: Format a methods signature for display.