code: def _fstring_parse(s, i, level, parts, exprs):
      
      while True:
          i, parse_expr = _find_literal(s, i, level, parts, exprs)
          if i == len(s) or s[i] == '}':
              return i
          if parse_expr:
              i = _find_expr(s, i, level, parts, exprs)
docs: Roughly Python/ast.c:fstring_find_literal_and_expr