def base_module_imports_in_module_recursive(module):
    "\n    Get a list of strings showing what base modules that are imported in a module, recursively.\n    It's the recursive version of the base_modules_used_in_module function.\n    Recursive in the sense that if module is a package module (i.e. containing a __init__.py and further submodules),\n    the base_modules_used_in_module function will be applied to all .py files under the mother folder.\n    Function returns a count (Counter object) of the number of modules where each base module was found.\n    :param module: An actual module object the file of the module (as given by inspect.getfile(module)\n    :param module_names: Modules to filter for.\n        None: Will grab all modules\n        A list or tuple: Of modules to grab\n        If not will assume module_names is a regex to apply to find module names\n    :return:\n    "
    if inspect.ismodule(module):
        module = inspect.getsourcefile(module)
    if module.endswith('__init__.py'):
        module = os.path.dirname(module)
    if os.path.isdir(module):
        c = Counter()
        it = get_filepath_iterator(module, pattern='.py$')
        next(it)
        for _module in it:
            try:
                c.update(base_module_imports_in_module_recursive(_module))
            except Exception as e:
                if ('sfood-imports' in e.args[1]):
                    raise RuntimeError("You don't have sfood-imports installed (snakefood), so I can't do my job")
                else:
                    print('Error with module {}: {}'.format(_module, e))
        return c
    elif (not os.path.isfile(module)):
        raise ValueError('module file not found: {}'.format(module))
    return Counter(base_modules_used_in_module(module))
Get a list of strings showing what base modules that are imported in a module, recursively.
It's the recursive version of the base_modules_used_in_module function.
Recursive in the sense that if module is a package module (i.e. containing a __init__.py and further submodules),
the base_modules_used_in_module function will be applied to all .py files under the mother folder.
Function returns a count (Counter object) of the number of modules where each base module was found.
:param module: An actual module object the file of the module (as given by inspect.getfile(module)
:param module_names: Modules to filter for.
    None: Will grab all modules
    A list or tuple: Of modules to grab
    If not will assume module_names is a regex to apply to find module names
:return:
def base_module_imports_in_module_recursive(module):
    "\n    Get a list of strings showing what base modules that are imported in a module, recursively.\n    It's the recursive version of the base_modules_used_in_module function.\n    Recursive in the sense that if module is a package module (i.e. containing a __init__.py and further submodules),\n    the base_modules_used_in_module function will be applied to all .py files under the mother folder.\n    Function returns a count (Counter object) of the number of modules where each base module was found.\n    :param module: An actual module object the file of the module (as given by inspect.getfile(module)\n    :param module_names: Modules to filter for.\n        None: Will grab all modules\n        A list or tuple: Of modules to grab\n        If not will assume module_names is a regex to apply to find module names\n    :return:\n    "
    if inspect.ismodule(module):
        module = inspect.getsourcefile(module)
    if module.endswith('__init__.py'):
        module = os.path.dirname(module)
    if os.path.isdir(module):
        c = Counter()
        it = get_filepath_iterator(module, pattern='.py$')
        next(it)
        for _module in it:
            try:
                c.update(base_module_imports_in_module_recursive(_module))
            except Exception as e:
                if ('sfood-imports' in e.args[1]):
                    raise RuntimeError("You don't have sfood-imports installed (snakefood), so I can't do my job")
                else:
                    print('Error with module {}: {}'.format(_module, e))
        return c
    elif (not os.path.isfile(module)):
        raise ValueError('module file not found: {}'.format(module))
    return Counter(base_modules_used_in_module(module))