the name of the attribute along with it' valid type then the decorator (lines - )extracts the 'key-valuepairs 'parameter-expected]_type(see line and pass these to descriptor 'typecheckthrough line if type is not validdescriptor will raise errorotherwise it will set the values to the variables finallythese set values will be used by the class 'rectfor further operations listing generalized attribute validation #rectgeneralized py class typecheckdef __init__(selfparameterexpected_type)self parameter parameter self expected_type expected_type def __get__(selfinstancecls)if instance is nonerequired if descriptor is return self used as class variable elsein this codeonly following line is required return instance __dict__[self parameter def __set__(selfinstancevalue)print("setting % to % (self parametervalue)if not isinstance(valueself expected_type)raise typeerror("% value is expectedself expected_typeinstance __dict__[self parametervalue def typeassert(**kwargs)def decorate(cls)for parameterexpected_type in kwargs items()setattr(clsparametertypecheck(parameterexpected_type)return cls return decorate define attribute types here in the decorator @typeassert(author=strlength intwidth floatclass rectdef __init__(self*lengthwidthauthor "")#require kwargs self length length self width width to accept integer as well self author author rect (length= width= author "meher"#setting length to #setting width to #setting author to meher # rect (length="len"width= author "meher"error shown below #file "rectproperty py"line ##typeerrorvalue is expected summary in this we learn about functions@propertydecorators and descriptors we see that @property is useful for customizing the single attribute whereas descriptor is suitable for multiple attributes furtherwe saw that how decorator and descriptor can be used to enhance the functionality of the code with dry (don' repeat yourselftechnique generalized attribute validation