code: def serialize(self):
          
          return {
              # Encode library information (future-proofing)
              'lib': {
                  'name': 'cqparts',
                  'version': __version__,
              },
              # class & name record, for automated import when decoding
              'class': {
                  'module': type(self).__module__,
                  'name': type(self).__name__,
              },
              'params': self.serialize_parameters(),
          }
docs: Encode a :class:`ParametricObject` instance to an object that can be
          encoded by the :mod:`json` module.
  
          :return: a dict of the format:
          :rtype: :class:`dict`
  
          ::
  
              {
                  'lib': {  # library information
                      'name': 'cqparts',
                      'version': '0.1.0',
                  },
                  'class': {  # importable class
                      'module': 'yourpartslib.submodule',  # module containing class
                      'name': 'AwesomeThing',  # class being serialized
                  },
                  'params': {  # serialized parameters of AwesomeThing
                      'x': 10,
                      'y': 20,
                  }
              }
  
          value of ``params`` key comes from :meth:`serialize_parameters`
  
          .. important::
  
              Serialize pulls the class name from the classes ``__name__`` parameter.
  
              This must be the same name of the object holding the class data, or
              the instance cannot be re-instantiated by :meth:`deserialize`.
  
          **Examples (good / bad)**
  
          .. doctest::
  
              >>> from cqparts.params import ParametricObject, Int
  
              >>> # GOOD Example
              >>> class A(ParametricObject):
              ...     x = Int(10)
              >>> A().serialize()['class']['name']
              'A'
  
              >>> # BAD Example
              >>> B = type('Foo', (ParametricObject,), {'x': Int(10)})
              >>> B().serialize()['class']['name']  # doctest: +SKIP
              'Foo'
  
          In the second example, the classes import name is expected to be ``B``.
          But instead, the *name* ``Foo`` is recorded. This mismatch will be
          irreconcilable when attempting to :meth:`deserialize`.