Useful for importing nested modules such as pymc.gp.cov_funs.isotropic_cov_funs.

    Updated with code copied from IPython under a BSD license.

def import_item(name):
    """
    Useful for importing nested modules such as pymc.gp.cov_funs.isotropic_cov_funs.

    Updated with code copied from IPython under a BSD license.
    """
    package = '.'.join(name.split('.')[0:-1])
    obj = name.split('.')[-1]

    if package:
        module = __import__(package,fromlist=[obj])
        return module.__dict__[obj]
    else:
        return __import__(obj)