'Get the names of all modules in the search_path. This means file names
and not names defined in the files.'

def _get_module_names(self, search_path=None, in_module=None):

    names = []
    if ((search_path is None) and (in_module is None)):
        names += [self._generate_name(name) for name in sys.builtin_module_names]
    if (search_path is None):
        search_path = self.sys_path_with_modifications()
    for (module_loader, name, is_pkg) in pkgutil.iter_modules(search_path):
        names.append(self._generate_name(name, in_module=in_module))
    return names
