def make_contrib(superclass, func=None):
 def contribute_to_class(self, cls, name):
  if func:
   func(self, cls, name)
  else:
   super(superclass, self).contribute_to_class(cls, name)
  setattr(cls, self.name, Creator(self))
 return contribute_to_class

def make_contrib ( superclass , func = None ) : def contribute_to_class ( self , cls , name ) : if func : func ( self , cls , name ) else : super ( superclass , self ) . contribute_to_class ( cls , name ) setattr ( cls , self . name , Creator ( self ) ) return contribute_to_class
returns a suitable contribute_to_class() method for the field subclass .