def register_to_openmath(self, py_class, converter):
if py_class is not None and not isclass(py_class):<EOL><INDENT>raise TypeError('<STR_LIT>' % py_class)<EOL><DEDENT>if not callable(converter) and not isinstance(converter, om.OMAny):<EOL><INDENT>raise TypeError('<STR_LIT>' % converter)<EOL><DEDENT>self._conv_to_om.append((py_class, converter))<EOL>
Register a conversion from Python to OpenMath

        :param py_class: A Python class the conversion is attached to, or None
        :type py_class: None, type

        :param converter: A conversion function or an OpenMath object
        :type converter: Callable, OMAny

        :rtype: None

        ``converter`` will used to convert any object of type ``py_class``,
        or any object if ``py_class`` is ``None``. If ``converter`` is an
        OpenMath object, it is returned immediately. If it is a callable, it
        is called with the Python object as paramter; in this case, it must
        either return an OpenMath object, or raise an exception.  The
        special exception ``CannotConvertError`` can be used to signify that
        ``converter`` does not know how to convert the current object, and that
        ``to_openmath`` shall continue with the other converters. Any other
        exception stops conversion immediately.

        Converters registered by this function are called in order from the
        most recent to the oldest.