code: def formatargspec(args, varargs=None, varkw=None, defaults=None,
                    formatarg=str,
                    formatvarargs=lambda name: '*' + name,
                    formatvarkw=lambda name: '**' + name,
                    formatvalue=lambda value: '=' + repr(value),
                    join=joinseq):
      
      specs = []
      if defaults:
          firstdefault = len(args) - len(defaults)
      for i in range(len(args)):
          spec = strseq(args[i], formatarg, join)
          if defaults and i >= firstdefault:
              spec = spec + formatvalue(defaults[i - firstdefault])
          specs.append(spec)
      if varargs:
          specs.append(formatvarargs(varargs))
      if varkw:
          specs.append(formatvarkw(varkw))
      return '(' + string.join(specs, ', ') + ')'
docs: Format an argument spec from the 4 values returned by getargspec.
  
      The first four arguments are (args, varargs, varkw, defaults).  The
      other four arguments are the corresponding optional formatting functions
      that are called to turn names and values into strings.  The ninth
      argument is an optional function to format the sequence of arguments.