'Helper for fake_import and fake_importlib_import to do the work.
Return:
The imported fake module, or None if normal importing should be
used.'

def _do_import(self, name):

    if (name not in self.modules):
        return None
    elif self.modules[name]:
        ns = types.SimpleNamespace()
        if (self.version_attribute is not None):
            setattr(ns, self.version_attribute, self.version)
        return ns
    else:
        raise ImportError('Fake    ImportError    for    {}.'.format(name))
