code: def find_balance_index(source, start='{', end='}'):
      
      state = 1
      for index, char in enumerate(source):
          if char == start:
              state += 1
          elif char == end:
              state -= 1
          if state == 0:
              return index
      raise RuntimeError('This should not happen: Balance Not Found')
docs: Get the first balance index.