def accepts_kwarg(func, kwarg):
 if (sys.version_info >= (3, 3)):
  signature = inspect.signature(func)
  try:
   signature.bind_partial(**{kwarg: None})
   return True
  except TypeError:
   return False
 else:
  argspec = inspect.getargspec(func)
  return ((kwarg in argspec.args) or (argspec.keywords is not None))

def accepts_kwarg ( func , kwarg ) : if ( sys . version_info >= ( 3 , 3 ) ) : signature = inspect . signature ( func ) try : signature . bind_partial ( ** { kwarg : None } ) return True except TypeError : return False else : argspec = inspect . getargspec ( func ) return ( ( kwarg in argspec . args ) or ( argspec . keywords is not None ) )
determine whether the callable func has a signature that accepts the keyword argument kwarg .