human
Complete this python program:
def collect_submodules(package, filter=(lambda name: True)):
assistant
#Here is the Python program you requested.

    """:param package: A string which names the package which will be search for
    submodules.
    :param approve: A function to filter through the submodules found,
    selecting which should be included in the returned list. It takes one
    argument, a string, which gives the name of a submodule. Only if the
    function returns true is the given submodule is added to the list of
    returned modules. For example, ``filter=lambda name: \test\ not in
    name`` will return modules that don\t contain the word ``test``.
    :return: A list of strings which specify all the modules in package. Its
    results can be directly assigned to ``hiddenimports`` in a hook script;
    see, for example, ``hook-sphinx.py``.
    This function is used only for hook scripts, but not by the body of
    PyInstaller.
    """
    if (not isinstance(package, string_types)):
        raise ValueError
    logger.debug(('Collecting    submodules    for    %s' % package))
    if (not is_package(package)):
        logger.debug(('collect_submodules    -    Module    %s    is    not    a    package.' % package))
        return []
    (pkg_base, pkg_dir) = get_package_paths(package)
    names = exec_statement("\n                                import    sys\n                                import    pkgutil\n\n                                #    ``pkgutil.walk_packages``    doesn't    walk    subpackages    of    zipped    files\n                                #    per    https://bugs.python.org/issue14209.    This    is    a    workaround.\n                                def    walk_packages(path=None,    prefix='',    onerror=None):\n                                                def    seen(p,    m={{}}):\n                                                                if    p    in    m:\n                                                                                return    True\n                                                                m[p]    =    True\n\n                                                for    importer,    name,    ispkg    in    pkgutil.iter_modules(path,    prefix):\n                                                                if    not    name.startswith(prefix):            ##    Added\n                                                                                name    =    prefix    +    name                                        ##    Added\n                                                                yield    importer,    name,    ispkg\n\n                                                                if    ispkg:\n                                                                                try:\n                                                                                                __import__(name)\n                                                                              ...