def get_signature(name, func):
args, varargs, keywords, defaults = inspect.getargspec(func)<EOL>defaults = defaults or []<EOL>posargslen = len(args) - len(defaults)<EOL>if varargs is None and keywords is None:<EOL><INDENT>sig = name + '<STR_LIT:(>'<EOL>sigargs = []<EOL>for idx, arg in enumerate(args):<EOL><INDENT>if idx < posargslen:<EOL><INDENT>sigargs.append(arg)<EOL><DEDENT>else:<EOL><INDENT>default = repr(defaults[idx - posargslen])<EOL>sigargs.append(arg + '<STR_LIT:=>' + default)<EOL><DEDENT><DEDENT>sig += '<STR_LIT:U+002CU+0020>'.join(sigargs) + '<STR_LIT:)>'<EOL>return sig<EOL><DEDENT>elif not args and varargs and not keywords and not defaults:<EOL><INDENT>return name + '<STR_LIT>' + varargs + '<STR_LIT:)>'<EOL><DEDENT>else:<EOL><INDENT>raise InvalidTask('<STR_LIT>')<EOL><DEDENT>
Helper to generate a readable signature for a function
:param name:
:param func:
:return: