# Path: mlpy/auxiliary/misc.py
# def listify(obj):
#     """Ensure that the object `obj` is of type list.
# 
#     If the object is not of type `list`, the object is
#     converted into a list.
# 
#     Parameters
#     ----------
#     obj :
#         The object.
# 
#     Returns
#     -------
#     list :
#         The object inside a list.
# 
#     """
#     if obj is None:
#         return []
# 
#     return obj if isinstance(obj, (list, type(None))) else [obj]


import os
import sys
import pickle
import importlib
from .misc import listify
    try:
        mymodule = __import__(module)
        sys.modules[global_name] = mymodule
    except ImportError:
        raise ImportError('Module could not be imported from %s.' % full_path)
    finally:
        del sys.path[-1]

    return mymodule


def load_from_file(filename, import_modules=None):
    """Load data from file.

    Different formats are supported.

    Parameters
    ----------
    filename : str
        Name of the file to load data from.
    import_modules : str or list
        List of modules that may be required by the data
        that need to be imported.

    Returns
    -------
    dict or list :
        The loaded data. If any errors occur, ``None`` is returned.

    """

# Path: mlpy/auxiliary/misc.py
# def listify(obj):
#     """Ensure that the object `obj` is of type list.
# 
#     If the object is not of type `list`, the object is
#     converted into a list.
# 
#     Parameters
#     ----------
#     obj :
#         The object.
# 
#     Returns
#     -------
#     list :
#         The object inside a list.
# 
#     """
#     if obj is None:
#         return []
# 
#     return obj if isinstance(obj, (list, type(None))) else [obj]


# Path: mlpy/auxiliary/io.py
import os
import sys
import pickle
import importlib
from .misc import listify

    try:
        mymodule = __import__(module)
        sys.modules[global_name] = mymodule
    except ImportError:
        raise ImportError('Module could not be imported from %s.' % full_path)
    finally:
        del sys.path[-1]

    return mymodule


def load_from_file(filename, import_modules=None):
    """Load data from file.

    Different formats are supported.

    Parameters
    ----------
    filename : str
        Name of the file to load data from.
    import_modules : str or list
        List of modules that may be required by the data
        that need to be imported.

    Returns
    -------
    dict or list :
        The loaded data. If any errors occur, ``None`` is returned.

    """

    for m in listify(import_modules):