code: def dumpHierarchyImpl(self, node, onlyVisibleNode=True):
          
  
          if not node:
              return None
  
          payload = {}
  
          # filter out all None values
          for attrName, attrVal in node.enumerateAttrs():
              if attrVal is not None:
                  payload[attrName] = attrVal
  
          result = {}
          children = []
          for child in node.getChildren():
              if not onlyVisibleNode or child.getAttr('visible'):
                  children.append(self.dumpHierarchyImpl(child, onlyVisibleNode))
          if len(children) > 0:
              result['children'] = children
  
          result['name'] = payload.get('name') or node.getAttr('name')
          result['payload'] = payload
  
          return result
docs: Crawl the hierarchy tree using the simple DFS algorithm. The ``dump`` procedure is the engine independent as
          the hierarchy structure is wrapped by :py:class:`AbstractNode <poco.sdk.AbstractNode>` and therefore the
          ``dump`` procedure can be algorithmized.
  
          Following code demonstrates the simplest implementation. Feel free to implement your own algorithms to
          optimize the performance.
  
          .. note:: Do not explicitly call this method as this is an internal function, call
                    :py:meth:`dumpHierarchy() <poco.sdk.AbstractDumper.AbstractDumper.dumpHierarchy>` function instead
                    if you want to dump the hierarchy.
  
          Args:
              node(:py:class:`inherit from AbstractNode <poco.sdk.AbstractNode>`): root node of the hierarchy to be
               dumped
              onlyVisibleNode(:obj:`bool`): dump only the visible nodes or all nodes, default to True
  
          Returns:
              :obj:`dict`: json serializable dict holding the whole hierarchy data