def _check_extension_attrs(cls):
 extends = cls.__extends__
 eattrs = extends.Attributes
 cattrs = cls.Attributes
 ckeys = set([k for k in vars(cls.Attributes) if (not k.startswith('_'))])
 ekeys = set([k for k in vars(extends.Attributes) if (not k.startswith('_'))])
 diff = set()
 for k in (ckeys | ekeys):
  if (getattr(eattrs, k, None) != getattr(cattrs, k, None)):
   diff.add(k)
 attr_names = ATTR_NAMES[cls]
 retval = None
 while (extends is not None):
  retval = extends
  if (len((diff & attr_names)) > 0):
   return extends
  extends = extends.__extends__
 return retval

def _check_extension_attrs ( cls ) : extends = cls . __extends__ eattrs = extends . Attributes cattrs = cls . Attributes ckeys = set ( [ k for k in vars ( cls . Attributes ) if ( not k . startswith ( '_' ) ) ] ) ekeys = set ( [ k for k in vars ( extends . Attributes ) if ( not k . startswith ( '_' ) ) ] ) diff = set ( ) for k in ( ckeys | ekeys ) : if ( getattr ( eattrs , k , None ) != getattr ( cattrs , k , None ) ) : diff . add ( k ) attr_names = ATTR_NAMES [ cls ] retval = None while ( extends is not None ) : retval = extends if ( len ( ( diff & attr_names ) ) > 0 ) : return extends extends = extends . __extends__ return retval
make sure only customizations that need a restriction tag generate one .