'An implementation similar to ``__import__``. Use `follow`
to actually follow the imports.
*level* specifies whether to use absolute or relative imports. 0 (the
default) means only perform absolute imports. Positive values for level
indicate the number of parent directories to search relative to the
directory of the module calling ``__import__()`` (see PEP 328 for the
details).
:param import_path: List of namespaces (strings or Names).'

def __init__(self, evaluator, import_path, module_context, level=0):

    debug.speed(('import    %s' % (import_path,)))
    self._evaluator = evaluator
    self.level = level
    self.module_context = module_context
    try:
        self.file_path = module_context.py__file__()
    except AttributeError:
        self.file_path = None
    if level:
        base = module_context.py__package__().split('.')
        if (base == ['']):
            base = []
        if (level > len(base)):
            path = module_context.py__file__()
            if (path is not None):
                import_path = list(import_path)
                p = path
                for i in range(level):
                    p = os.path.dirname(p)
                dir_name = os.path.basename(p)
                if dir_name:
                    if path.endswith((os.path.sep + 'os.py')):
                        import_path.insert(0, 'os')
                    else:
                        import_path.insert(0, dir_name)
                else:
                    _add_error(module_context, import_path[(-1)])
                    import_path = []
                    debug.warning('Attempted    relative    import    beyond    top-level    package.')
        else:
            import_path = (tuple(base) + tuple(import_path))
    self.import_path = import_path
