def class_id(cls):
    """
    Returns the full id of a *class*, i.e., the id of the module it is defined in, extended by the
    name of the class. Example:

    .. code-block:: python

       # module a.b

       class MyClass(object):
           ...

       class_id(MyClass)
       # "a.b.MyClass"
    """
    name = cls.__name__
    module = cls.__module__

    # skip empty and builtin modules
    if not module or module == str.__module__:
        return name
    else:
        return module + "." + name