code: def traverse_layout(root, callback):
      
      callback(root)
      if isinstance(root, collections.Iterable):
          for child in root:
              traverse_layout(child, callback)
docs: Tree walker and invokes the callback as it
      traverse pdf object tree