(the_module, do_action, traverse_submodules_flag=True)
return None
Traverses ``the_module`` and performs action :func:`do_action` on each of the objects of the structure.

    :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 do_action: Function that takes one parameter ``module_obj`` as input. It returns ``True`` if
        traversal needs to be stopped.
    :param traverse_submodules_flag: True if function must recursively traverse submodules too
    :return: Returns tuple ``(the_module, obj)`` where ``obj`` is the object identified by :func:`do_action` and
        ``the_module`` is the corresponding dictionary structure to which the object belongs. It returns ``None``
        if no object has been identified by the :func:`do_action`
Traverses ``the_module`` and performs action :func:`do_action` on each of the objects of the structure.
Traverses the_module and performs action : func : do_action on each of the objects of the structure .
def traverse(the_module, do_action, traverse_submodules_flag=True):
    """
    Traverses ``the_module`` and performs action :func:`do_action` on each of the objects of the structure.

    :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 do_action: Function that takes one parameter ``module_obj`` as input. It returns ``True`` if
        traversal needs to be stopped.
    :param traverse_submodules_flag: True if function must recursively traverse submodules too
    :return: Returns tuple ``(the_module, obj)`` where ``obj`` is the object identified by :func:`do_action` and
        ``the_module`` is the corresponding dictionary structure to which the object belongs. It returns ``None``
        if no object has been identified by the :func:`do_action`
    """
    if do_action(the_module['module_obj']):
        return the_module, the_module['module_obj']

    # Traverse classes of the_module
    for the_class in the_module['classes']:
        if do_action(the_class):
            return the_module, the_class

    # Traverse functions of the_module
    for the_func in the_module['functions']:
        if do_action(the_func):
            return the_module, the_func

    # Recursively traverse submodules of the_module
    if traverse_submodules_flag:
        for submodule in the_module['submodules']:
            the_tuple = traverse(submodule, do_action, traverse_submodules_flag)
            if the_tuple is not None:
                return the_tuple

    return None
def traverse ( the_module , do_action , traverse_submodules_flag = True ) : if do_action ( the_module [ 'module_obj' ] ) : return the_module , the_module [ 'module_obj' ] # Traverse classes of the_module for the_class in the_module [ 'classes' ] : if do_action ( the_class ) : return the_module , the_class # Traverse functions of the_module for the_func in the_module [ 'functions' ] : if do_action ( the_func ) : return the_module , the_func # Recursively traverse submodules of the_module if traverse_submodules_flag : for submodule in the_module [ 'submodules' ] : the_tuple = traverse ( submodule , do_action , traverse_submodules_flag ) if the_tuple is not None : return the_tuple return None