def display_hierarchy_helper(root, parent_id_to_children, depth):
  """Recursive helper for displaying the hierarchy.

  Args:
    root: The current root ad unit.
    parent_id_to_children: The overall map of parent ids to children.
    depth: The current depth.
  """
  print '%s%s (%s)' % ('%s+--' % ('|'.join(['  '] * depth)),
                       root['name'], root['id'])

  # Recurse for each child of this root that has children.
  for child in parent_id_to_children.get(root['id'], []):
    display_hierarchy_helper(child, parent_id_to_children, depth + 1)
Recursive helper for displaying the hierarchy.

  Args:
    root: The current root ad unit.
    parent_id_to_children: The overall map of parent ids to children.
    depth: The current depth.