parameters: (func, args)
return_statement: return func(**required_args)
docstring: This is similar to func(**args), but this won't complain about
      extra keys in 'args'. This ignores keys in 'args' that are
      not required by 'func'. This passes None to arguments that are
      not defined in 'args'. That's fine for arguments with a default valeue, but
      that's a bug for required arguments. I should probably raise a TypeError.
      The func parameter can be a function reference or a string.
      If it is a string then it is converted to a function reference.
docstring_summary: This is similar to func(**args), but this won't complain about
      extra keys in 'args'. This ignores keys in 'args' that are
      not required by 'func'. This passes None to arguments that are
      not defined in 'args'. That's fine for arguments with a default valeue, but
      that's a bug for required arguments. I should probably raise a TypeError.
      The func parameter can be a function reference or a string.
      If it is a string then it is converted to a function reference.
docstring_tokens: This is similar to func ( ** args ) but this won t complain about extra keys in args . This ignores keys in args that are not required by func . This passes None to arguments that are not defined in args . That s fine for arguments with a default valeue but that s a bug for required arguments . I should probably raise a TypeError . The func parameter can be a function reference or a string . If it is a string then it is converted to a function reference .
function: def apply_smart(func, args):
      """This is similar to func(**args), but this won't complain about
      extra keys in 'args'. This ignores keys in 'args' that are
      not required by 'func'. This passes None to arguments that are
      not defined in 'args'. That's fine for arguments with a default valeue, but
      that's a bug for required arguments. I should probably raise a TypeError.
      The func parameter can be a function reference or a string.
      If it is a string then it is converted to a function reference.
      """
      if isinstance(func, type('')):
          if func in globals():
              func = globals()[func]
          else:
              raise NameError("name '%s' is not defined" % func)
      if hasattr(func, 'im_func'):  # Handle case when func is a class method.
          func = func.im_func
      argcount = func.func_code.co_argcount
      required_args = dict([(k, args.get(k))
                            for k in func.func_code.co_varnames[:argcount]])
      return func(**required_args)
function_tokens: def apply_smart ( func , args ) : if isinstance ( func , type ( '' ) ) : if func in globals ( ) : func = globals ( ) [ func ] else : raise NameError ( "name '%s' is not defined" % func ) if hasattr ( func , 'im_func' ) : # Handle case when func is a class method. func = func . im_func argcount = func . func_code . co_argcount required_args = dict ( [ ( k , args . get ( k ) ) for k in func . func_code . co_varnames [ : argcount ] ] ) return func ( * * required_args )