def is_package(module_name):
 try:
  loader = pkgutil.find_loader(module_name)
 except Exception:
  return False
 else:
  if loader:
   return loader.is_package(module_name)
  else:
   return False

def is_package ( module_name ) : try : loader = pkgutil . find_loader ( module_name ) except Exception : return False else : if loader : return loader . is_package ( module_name ) else : return False
check if a python module is really a module or is a package containing other modules .