def get_spec(func):
 if (inspect.isfunction(func) or inspect.ismethod(func)):
  spec = inspect.getargspec(func)
 elif hasattr(func, '__call__'):
  spec = inspect.getargspec(func.__call__)
 else:
  raise TypeError(('%s is not callable' % type(func)))
 defaults = (spec.defaults or [])
 firstdefault = (len(spec.args) - len(defaults))
 args = spec.args[:firstdefault]
 kwargs = dict(zip(spec.args[firstdefault:], defaults))
 return (args, kwargs)

def get_spec ( func ) : if ( inspect . isfunction ( func ) or inspect . ismethod ( func ) ) : spec = inspect . getargspec ( func ) elif hasattr ( func , '__call__' ) : spec = inspect . getargspec ( func . __call__ ) else : raise TypeError ( ( '%s is not callable' % type ( func ) ) ) defaults = ( spec . defaults or [ ] ) firstdefault = ( len ( spec . args ) - len ( defaults ) ) args = spec . args [ : firstdefault ] kwargs = dict ( zip ( spec . args [ firstdefault : ] , defaults ) ) return ( args , kwargs )
returns tuple for a function .