collections abcs advanced programming techniques we could have checked that the load and save attributes are callable using hasattr(to check that they have the __call__ attributebut we prefer to check whether they are instances of collections callable instead the collections callable abstract base class provides the promise (but no guaranteethat instances of its subclasses (or virtual subclassesare callable once the class has been created (using type __new__(or reimplementation of __new__())the metaclass is initialized by calling its __init__(method the arguments given to __init__(are clsthe class that' just been createdclassnamethe class' name (also available from cls __name__)basesa list of the class' base classes (excluding objectand therefore possibly empty)and dictionary that holds the attributes that became class attributes when the cls class was createdunless we intervened in reimplementation of the metaclass' __new__(method here are couple of interactive examples that show what happens when we create classes using the loadablesaveable metaclassclass bad(metaclass=meta loadablesaveable)def some_method(self)pass traceback (most recent call last)assertionerrorclass 'badmust provide load(method the metaclass specifies that classes using it must provide certain methodsand when they don'tas in this casean assertionerror exception is raised class good(metaclass=meta loadablesaveable)def load(self)pass def save(self)pass good(the good class honors the metaclass' api requirementseven if it doesn' meet our informal expectations of how it should behave we can also use metaclasses to change the classes that use them if the change involves the namebase classesor dictionary of the class being created ( its slots)then we need to reimplement the metaclass' __new__(methodbut for other changessuch as adding methods or data attributesreimplementing __init__(is sufficientalthough this can also be done in __new__(we will now look at metaclass that modifies the classes it is used with purely through its __new__(method as an alternative to using the @property and @name setter decoratorswe could create classes where we use simple naming convention to identify properties for exampleif class has methods of the form get_name(and set_name()we would expect the class to have private __name property accessed using