import pkgutil
import zipimport


def get_module_zip_archive(module):
  """Given a module, returns path to a zip package that contains it or None."""
  loader = pkgutil.get_loader(module)
  if not isinstance(loader, zipimport.zipimporter):
    return None
  # 'archive' property is documented only for python 2.7, but it appears to be
  # there at least since python 2.5.2.
  return loader.archive