<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_importer(cls, name):
 """ Get an importer for the given registered type. :param cls: class to import :type cls: :class:`type` :param name: registered name of importer :type name: :class:`str` :return: an importer instance of the given type :rtype: :class:`Importer` :raises TypeError: if importer cannot be found """

    if name not in importer_index:
        raise TypeError(
            ("importer type '%s' is not registered: " % name) +
            ("registered types: %r" % sorted(importer_index.keys()))
        )

    for base_class in importer_index[name]:
        if issubclass(cls, base_class):
            return importer_index[name][base_class](cls)

    raise TypeError("importer type '%s' for a %r is not registered" % (
        name, cls
    ))