def get_bonds(struct):
  """Get a list of bonds in a dot-paren structure."""
  struct = struct.replace("+", "")  # Positions do NOT include strand breaks
  bonds = []  # Will be a list of pairs (open_postion, close_postion)
  open_pos = []  # A FILO of open parentheses positions
  
  for pos, symb in enumerate(struct):
    if symb == "(":
      open_pos.append(pos)
    elif symb == ")":
      assert len(open_pos) != 0
      start = open_pos.pop() # The most recent open-paren
      bonds.append( (start, pos) )
    else:
      assert symb == ".", "Structure '%s' not in dot-paren form" % struct
  
  return bonds