def import_name(name):
    """
    Import an object by its qualified name.

    Can be used to load a module, submodule, class, function, or other
    object, including in situations where the regular `import` statement
    would fail.

    Parameters
    ----------
    name : str
        The fully qualified name of the object to import

    Returns
    -------
    object
        The imported object

    See Also
    --------
    IPython.utils.importstring.import_item :
        https://github.com/ipython/ipython/blob/b3355a9/IPython/utils/importstring.py#L10

    Notes
    -----
    This is a near-exact reimplementation of
    `IPython.utils.importstring.import_item`. This version exists to
    make it available in pure Python environments where `IPython` may
    not be installed.
    """
    parts = name.rsplit('.', maxsplit=1)
    if len(parts) == 2:
        mod_name, obj_name = parts
        # built-in __import__ should be faster than importlib.__import__
        module = __import__(mod_name, fromlist=[obj_name])
        try:
            obj = getattr(module, obj_name)
        except AttributeError as e:
            raise ImportError(
                f'No module or object "{obj_name}" found in "{mod_name}"'
            ) from e
        return obj
    return __import__(parts[0])