ó
æNXc           @   s   d  Z  d „  Z d S(   s:   
A simple utility to import something by its string name.
c         C   s’   |  j  d d ƒ } t | ƒ d k r€ | \ } } t | d | g ƒ} y t | | ƒ } Wn! t k
 r{ t d | ƒ ‚ n X| St | d ƒ Sd S(   s†  Import and return ``bar`` given the string ``foo.bar``.

    Calling ``bar = import_item("foo.bar")`` is the functional equivalent of
    executing the code ``from foo import bar``.

    Parameters
    ----------
    name : string
      The fully qualified name of the module/package being imported.

    Returns
    -------
    mod : module object
       The module that was imported.
    t   .i   i   t   fromlists   No module named %si    N(   t   rsplitt   lent
   __import__t   getattrt   AttributeErrort   ImportError(   t   namet   partst   packaget   objt   modulet   pak(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/ipython_genutils/importstring.pyt   import_item
   s    N(   t   __doc__R   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/ipython_genutils/importstring.pyt   <module>   s   