def find_package(packagename, searchpath=None):
    try:
        return sys.modules[packagename]
    except KeyError:
        pass
    for pkgname in _iter_subpath(packagename):
        if "." in pkgname:
            basepkg, subpkg = pkgname.rsplit(".", 1)
            pkg = sys.modules[basepkg]
            _load_package(subpkg, basepkg, pkg.__path__)
        else:
            try:
                sys.modules[pkgname]
            except __HOLE__:
                _load_package(pkgname, None, searchpath)
    return sys.modules[packagename]
dataset/ETHPy150Open kdart/pycopia/core/pycopia/devhelpers.py/find_package