def _package_path(name):
 loader = pkgutil.get_loader(name)
 if ((loader is None) or (name == u'__main__')):
  return None
 if hasattr(loader, u'get_filename'):
  filepath = loader.get_filename(name)
 else:
  __import__(name)
  filepath = sys.modules[name].__file__
 return os.path.dirname(os.path.abspath(filepath))

def _package_path ( name ) : loader = pkgutil . get_loader ( name ) if ( ( loader is None ) or ( name == u'__main__' ) ) : return None if hasattr ( loader , u'get_filename' ) : filepath = loader . get_filename ( name ) else : __import__ ( name ) filepath = sys . modules [ name ] . __file__ return os . path . dirname ( os . path . abspath ( filepath ) )
returns the path to the package containing the named module or none if the path could not be identified .