code: def parse_overlay(overlay):
      new_overlay = overlay
      prev_len = len(overlay.nodes)
  
      collapsers = [collapse_sequences, collapse_branches]
  
      while True:
          new_overlay = collapse_branches(
              collapse_sequences(new_overlay)
          )
          if not len(new_overlay.nodes) < prev_len:
              break
          prev_len = len(new_overlay.nodes)
  
      if len(new_overlay.nodes) != 1:
          return None
  
      return flatten_sequences(parse_structure(new_overlay.nodes[0]))
  
file_path: lucid/lucid/misc/graph_analysis/parse_overlay.py
imports: from lucid.misc.graph_analysis.overlay_graph import OverlayGraph, OverlayNode, OverlayStructure
label_desc: Use image node_id 5 for calling a global function with example usage: parse_overlay(overlay) and returns: flatten_sequences, None