(module_obj, the_module, inspected, skip_test)
Initializes hierarchical structure ``the_module``.

    :param module_obj: Module object being traversed.
    :param the_module: Dictionary ``{'module_obj': module_obj, 'submodules': submodules,
        'classes': classes, 'functions': functions}``. The ``submodules`` is the list of
        submodules that belong to ``module_obj``. Each submodule has the same structure as ``the_module``.
        The ``classes`` is the list of classes that belong to ``module_obj``.
        The functions is the list of functions that belong ``to module_obj``.
    :param inspected: Set of already traversed module objects. This set is needed to avoid circular traversal of
        the same module, which may be returned by by ``getmembers`` function multiple times.
    :param skip_test: Function that takes module object as an argument and returns True if this object
        needs to be included in the module structure hierarchy or skipped if False. This function is used as
        a mechanism to customize the structure of modules, classes, and functions. This in turn minimizes following
        structure traversal costs.
Initializes hierarchical structure ``the_module``.
Initializes hierarchical structure the_module .
def init_module_structure(module_obj, the_module, inspected, skip_test):
    """
    Initializes hierarchical structure ``the_module``.

    :param module_obj: Module object being traversed.
    :param the_module: Dictionary ``{'module_obj': module_obj, 'submodules': submodules,
        'classes': classes, 'functions': functions}``. The ``submodules`` is the list of
        submodules that belong to ``module_obj``. Each submodule has the same structure as ``the_module``.
        The ``classes`` is the list of classes that belong to ``module_obj``.
        The functions is the list of functions that belong ``to module_obj``.
    :param inspected: Set of already traversed module objects. This set is needed to avoid circular traversal of
        the same module, which may be returned by by ``getmembers`` function multiple times.
    :param skip_test: Function that takes module object as an argument and returns True if this object
        needs to be included in the module structure hierarchy or skipped if False. This function is used as
        a mechanism to customize the structure of modules, classes, and functions. This in turn minimizes following
        structure traversal costs.
    """

    # Returns True if the mod module needs to be ignored
    def _is_skip_module(mod):
        mod_name = mod.__name__
        return '._' in mod_name or mod_name.startswith('_')

    # Returns True if the class cls needs to be ignored
    def _is_skip_class(cls):
        class_name = get_fully_qualified_name(cls)
        return '._' in class_name

    # Returns True if the object obj needs to be ignored
    def _is_internal(obj):
        obj_name = obj.__name__
        return obj_name.startswith('_')

    # ************  The init_module_structure implementation starts here  *******************************************
    if _is_skip_module(module_obj) or module_obj in inspected or skip_test(module_obj):
        return

    inspected.add(module_obj)

    # Traverse submodules, classes, and functions
    submodules = []
    classes = []
    functions = []
    for (name, obj) in getmembers(module_obj):  # Iterate through members of the submodule
        if skip_test(obj):
            continue  # Customizable test for skipping objects as needed

        if ismodule(obj) and obj not in inspected and not _is_skip_module(obj):
            the_submodule = dict()
            init_module_structure(obj, the_submodule, inspected, skip_test)
            submodules.append(the_submodule)

        if isclass(obj) and not _is_skip_class(obj):
            classes.append(obj)

        if isfunction(obj) and not _is_internal(obj):
            functions.append(obj)

    the_module['module_obj'] = module_obj
    the_module['submodules'] = submodules
    the_module['classes'] = classes
    the_module['functions'] = functions
def init_module_structure ( module_obj , the_module , inspected , skip_test ) : # Returns True if the mod module needs to be ignored def _is_skip_module ( mod ) : mod_name = mod . __name__ return '._' in mod_name or mod_name . startswith ( '_' ) # Returns True if the class cls needs to be ignored def _is_skip_class ( cls ) : class_name = get_fully_qualified_name ( cls ) return '._' in class_name # Returns True if the object obj needs to be ignored def _is_internal ( obj ) : obj_name = obj . __name__ return obj_name . startswith ( '_' ) # ************  The init_module_structure implementation starts here  ******************************************* if _is_skip_module ( module_obj ) or module_obj in inspected or skip_test ( module_obj ) : return inspected . add ( module_obj ) # Traverse submodules, classes, and functions submodules = [ ] classes = [ ] functions = [ ] for ( name , obj ) in getmembers ( module_obj ) : # Iterate through members of the submodule if skip_test ( obj ) : continue # Customizable test for skipping objects as needed if ismodule ( obj ) and obj not in inspected and not _is_skip_module ( obj ) : the_submodule = dict ( ) init_module_structure ( obj , the_submodule , inspected , skip_test ) submodules . append ( the_submodule ) if isclass ( obj ) and not _is_skip_class ( obj ) : classes . append ( obj ) if isfunction ( obj ) and not _is_internal ( obj ) : functions . append ( obj ) the_module [ 'module_obj' ] = module_obj the_module [ 'submodules' ] = submodules the_module [ 'classes' ] = classes the_module [ 'functions' ] = functions