'GET /api/datatypes/mapping
Return a dictionary of class to class mappings.'

@expose_api_anonymous_and_sessionless
def mapping(self, trans, **kwd):

    try:
        ext_to_class_name = dict()
        classes = []
        for (k, v) in self._datatypes_registry.datatypes_by_extension.iteritems():
            c = v.__class__
            ext_to_class_name[k] = ((c.__module__ + '.') + c.__name__)
            classes.append(c)
        class_to_classes = dict()
        def visit_bases(types, cls):
            for base in cls.__bases__:
                if issubclass(base, Data):
                    types.add(((base.__module__ + '.') + base.__name__))
                visit_bases(types, base)
        for c in classes:
            n = ((c.__module__ + '.') + c.__name__)
            types = set([n])
            visit_bases(types, c)
            class_to_classes[n] = dict(((t, True) for t in types))
        return dict(ext_to_class_name=ext_to_class_name, class_to_classes=class_to_classes)
    except Exception as exception:
        log.error('could    not    get    datatype    mapping:    %s', str(exception), exc_info=True)
        if (not isinstance(exception, exceptions.MessageException)):
            raise exceptions.InternalServerError(str(exception))
        else:
            raise
