def imp_find_module(name, path=None):
 names = name.split('.')
 if (path is not None):
  if isinstance(path, (str, unicode)):
   path = [os.path.realpath(path)]
 for name in names:
  result = imp.find_module(name, path)
  if (result[0] is not None):
   result[0].close()
  path = [result[1]]
 return result

def imp_find_module ( name , path = None ) : names = name . split ( '.' ) if ( path is not None ) : if isinstance ( path , ( str , unicode ) ) : path = [ os . path . realpath ( path ) ] for name in names : result = imp . find_module ( name , path ) if ( result [ 0 ] is not None ) : result [ 0 ] . close ( ) path = [ result [ 1 ] ] return result
same as imp .