[docs]defargscan(*args,**kwargs):""" The attibute name must be given as keyword argument "arg". Giving the name allows it to be looked-up in the argument dictionary or locals(). """argname=kwargs.get("arg",None)forvalinargs:ifvalisREQ:raiseTypeError("Argument {0} is required and must be supplied to above function".format(argname))elif(argnameisnotNone)andisinstance(val,MappingABC):m_arg=val.get(argname,UNSPEC)ifm_argisnotUNSPEC:returnm_argelifvalisnotUNSPEC:returnval# return the last value, likely None or the loop would have returned itreturnval
# Special unique value to specify that arguments are required or not yet specifiedREQ=(argscan,"REQUIRED")UNSPEC=(argscan,"UNSPECIFIED")