def rdiscover_modules(directory):
found = list()<EOL>if os.path.isdir(directory):<EOL><INDENT>for entry in os.listdir(directory):<EOL><INDENT>next_dir = os.path.join(directory, entry)<EOL>if os.path.isfile(os.path.join(next_dir, MODULE_INIT_FILE)):<EOL><INDENT>modules = _search_for_modules(next_dir, True, entry)<EOL>found.extend(modules)<EOL><DEDENT><DEDENT><DEDENT>return found<EOL>
Attempts to list all of the modules and submodules found within a given
directory tree. This function recursively searches the directory tree
for potential python modules and returns a list of candidate names.

**Note:** This function returns a list of strings representing
discovered module names, not the actual, loaded modules.

:param directory: the directory to search for modules.