import importlib


def manifest_import(namespace, manifest):
  """Imports a module using a namespace manifest to find the module.
  """
  if not manifest:
    raise ImportError('No manifest provided')
  elif namespace not in manifest:
    raise ImportError('Manfest does not contain namespace: %s' % namespace)

  return importlib.import_module(manifest[namespace])