code: def for_each(self, action, filter=None):
          
          for component in self.components:
              # Recurse into child ROM tables.
              if isinstance(component, ROMTable):
                  component.for_each(action, filter)
                  continue
              
              # Skip component if the filter returns False.
              if filter is not None and not filter(component):
                  continue
              
              # Perform the action.
              action(component)
docs: ! @brief Apply an action to every component defined in the ROM table and child tables.
          
          This method iterates over every entry in the ROM table. For each entry it calls the
          filter function if provided. If the filter passes (returns True or was not provided) then
          the action function is called.
          
          The ROM table must have been initialized by calling init() prior to using this method.
          
          @param self This object.
          @param action Callable that accepts a single parameter, a CoreSightComponentID instance.
          @param filter Optional filter callable. Must accept a CoreSightComponentID instance and
              return a boolean indicating whether to perform the action (True applies action).