code: def parse_yaml(yaml_text):
      def tokenize(yaml):
          indents = [0]
          yield "INDENT"
          for lineno, line in enumerate(yaml.split("\n")):
              lline = line.rstrip()
              bline = lline.lstrip()
              if bline == "":
                  continue
              indent_len = len(lline) - len(bline)
              assert indent_len >= 0
              if indent_len > indents[-1]:
                  indents.append(indent_len)
                  yield "INDENT"
              while indent_len < indents[-1]:
                  indents.pop()
                  yield "DEDENT"
              assert indent_len == indents[-1], (
                  "Unexpected indentation in YAML file, line %d"
                  % lineno
              )
              yield bline
          yield "DEDENT"
  
      def consume_object(token_stream):
          yaml = None
          for tok in token_stream:
              if tok.startswith("#"):
                  continue
              if tok.startswith("{%") and tok.endswith("%}"):
                  continue
              if tok == "INDENT":
                  assert yaml is None
                  continue
              if tok == "DEDENT":
                  break
              if yaml is None:
                  if re.match("^(\w+):.*", tok):
                      yaml = {}
                  if tok.startswith("-"):
                      yaml = []
                  assert yaml is not None, "Unexpected token: %s" % tok
              if isinstance(yaml, dict):
                  mm = re.match("^(\w+):(.*)", tok)
                  assert mm, "Unexpected token: %s" % tok
                  if mm.group(2):
                      yaml[mm.group(1)] = mm.group(2).strip()
                  else:
                      yaml[mm.group(1)] = consume_object(token_stream)
              if isinstance(yaml, list):
                  yaml.append(tok[1:].lstrip())
          return yaml
  
      return consume_object(tokenize(yaml_text))
  
file_path: h2o-3/h2o-py/scripts/verify_requirements.py
imports: import argparse
  import os
  import re
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: parse_yaml(yaml_text) and returns: consume_object, yaml