code: def generate_docs(klass):
      
      import numina.types.datatype
  
      attrh = ('Attributes\n'
               '----------\n')
  
      doc = getattr(klass, '__doc__', None)
  
      if doc is None or doc == '':
          doc = "%s documentation." % klass.__name__
  
      if len(klass.stored()):
          doc = doc + '\n\n' + attrh
  
      skeys = sorted(klass.stored().keys())
      for key in skeys:
          y = klass.stored()[key]
  
          if isinstance(y, Requirement):
              modo = 'requirement'
          elif isinstance(y, Result):
              modo = 'product'
          else:
              modo = ""
          if y.type.isproduct():
              tipo = y.type.__class__.__name__
          elif isinstance(y.type, numina.types.datatype.PlainPythonType):
              tipo = y.type.internal_type.__name__
          else:
              tipo = y.type.__class__.__name__
  
          if y.optional:
              if y.default_value():
                  modo = "%s, optional, default=%s" % (modo, y.default)
              else:
                  modo = "%s, optional" % (modo,)
  
          descript = y.description
          if descript:
              field = "%s : %s, %s\n %s\n" % (key, tipo, modo, descript)
          else:
              field = "%s : %s, %s\n" % (key, tipo, modo)
          doc = doc + field
  
      klass.__doc__ = doc
      return klass
docs: Add documentation to generated classes