code: def filter_on_submodules(all_modules, submodules):
      """Filters all the modules based on the modules flag.
  
      The module flag has to be relative to the core package imported.
      For example, if `module=keras.layers` then, this function will return
      all the modules in the submodule.
  
      Args:
        all_modules: All the modules in the core package.
        submodules: Submodules to filter from all the modules.
  
      Returns:
        All the modules in the submodule.
      """
  
      filtered_modules = []
  
      for mod in all_modules:
          for submodule in submodules:
              # The below for loop is a constant time loop.
              for package in PACKAGES:
                  if package + submodule in mod.__name__:
                      filtered_modules.append(mod)
  
      return filtered_modules
  
imports: import importlib
  import os
  import pkgutil
  import sys
  from absl import flags
  from absl.testing import absltest
  import numpy
  import tensorflow.compat.v2
  from tensorflow.python.eager import context
  from tensorflow.python.ops import logging_ops
  from tensorflow.tools.docs import tf_doctest_lib
  import doctest
label_desc: Use image node_id 3 for calling a global function with example usage: filter_on_submodules(all_modules, submodules) and returns: filtered_modules