def validate_args(fn, *args, **kwargs):
    argspec = inspect.getargspec(fn)

    num_defaults = len(argspec.defaults or [])
    required_args = argspec.args[:len(argspec.args) - num_defaults]

    def isbound(method):
        return getattr(method, '__self__', None) is not None

    if isbound(fn):
        required_args.pop(0)

    missing = [arg for arg in required_args if arg not in kwargs]
    missing = missing[len(args):]
    if missing:
        raise MissingArgs(missing)
Check that the supplied args are sufficient for calling a function.
dataset/ETHPy150Open openstack/python-ironicclient/ironicclient/common/cliutils.py/validate_args