code: def parse_vexrc(inp, environ):
      
      heading = None
      errors = []
      with inp:
          for line_number, line in enumerate(inp):
              line = line.decode("utf-8")
              if not line.strip():
                  continue
              extracted_heading = extract_heading(line)
              if extracted_heading is not None:
                  heading = extracted_heading
                  continue
              kv_tuple = extract_key_value(line, environ)
              if kv_tuple is None:
                  errors.append((line_number, line))
                  continue
              try:
                  yield heading, kv_tuple[0], kv_tuple[1]
              except GeneratorExit:
                  break
      if errors:
          raise InvalidConfigError(inp.name, errors)
docs: Iterator yielding key/value pairs from given stream.
  
      yields tuples of heading, key, value.