def find_module(module, paths=None):
 parts = module.split('.')
 while parts:
  part = parts.pop(0)
  (f, path, (suffix, mode, kind)) = info = imp.find_module(part, paths)
  if (kind == PKG_DIRECTORY):
   parts = (parts or ['__init__'])
   paths = [path]
  elif parts:
   raise ImportError(("Can't find %r in %s" % (parts, module)))
 return info

def find_module ( module , paths = None ) : parts = module . split ( '.' ) while parts : part = parts . pop ( 0 ) ( f , path , ( suffix , mode , kind ) ) = info = imp . find_module ( part , paths ) if ( kind == PKG_DIRECTORY ) : parts = ( parts or [ '__init__' ] ) paths = [ path ] elif parts : raise ImportError ( ( "Can't find %r in %s" % ( parts , module ) ) ) return info
try to find the named module on the given search path or sys .