code: def parse_config_line(orig_config_line):
      # Remove comments.
      # note: splitting on '#' will always give at least one field...  python
      # treats splitting on space as a special case that may give zero fields.
      config_line = orig_config_line.split("#")[0]
      # Note: this set of allowed characters may have to be expanded in future.
      x = re.search('[^a-zA-Z0-9\.\-\(\)@_=,/+:\s"]', config_line)
      if x is not None:
          bad_char = x.group(0)
          if bad_char == "'":
              raise RuntimeError(
                  "Xconfig line has disallowed character ' (use "
                  "double quotes for strings containing = signs)"
              )
          else:
              raise RuntimeError(
                  "Xconfig line has disallowed character: {0}".format(
                      bad_char
                  )
              )
  
      # Now split on space; later we may splice things back together.
      fields = config_line.split()
      if len(fields) == 0:
          return (
              None  # Line was only whitespace after removing comments.
          )
      first_token = fields[0]
      # if first_token does not look like 'foo-bar' or 'foo-bar2', then die.
      if re.match("^[a-z][-a-z0-9]+$", first_token) is None:
          raise RuntimeError(
              "Error parsing config line (first field doesn't look right)."
          )
  
      # get rid of the first field which we put in 'first_token'.
      fields = fields[1:]
  
      rest_of_line = " ".join(fields)
      # rest of the line can be of the form 'a=1 b=" x=1 y=2 " c=Append( i1, i2)'
      positions = [x.start() for x in re.finditer('"', rest_of_line)]
      if not len(positions) % 2 == 0:
          raise RuntimeError("Double-quotes should occur in pairs")
  
      # Replace all the equals signs inside the "-enclosed strings
      # with question marks ('?') [this is just an arbitrary character
      # that won't otherwise be present, search above for 'banned'],
      # and replace the quotation marks themselves with spaces.
      # Then later on we'll convert all the question marks to
      # equals signs in the values in the dicts.
      num_strings = len(positions) // 2
      fields = []
      for i in range(num_strings):
          start = positions[i * 2]
          end = positions[i * 2 + 1]
  
          line_before_start = rest_of_line[:start]
          inside_quotes = rest_of_line[start + 1 : end].replace(
              "=", "?"
          )
          line_after_end = rest_of_line[end + 1 :]
          # the reason why we include the spaces here, is to keep the length of
          # rest_of_line the same, and the positions in 'positions' valid.
          new_rest_of_line = (
              line_before_start
              + " "
              + inside_quotes
              + " "
              + line_after_end
          )
          assert len(new_rest_of_line) == len(rest_of_line)
          rest_of_line = new_rest_of_line
  
      # suppose rest_of_line is: 'input=Append(foo, bar) foo=bar'
      # then after the below we'll get
      # fields = ['', 'input', 'Append(foo, bar)', 'foo', 'bar']
      ans_dict = dict()
      other_fields = re.split(r"\s*([-a-zA-Z0-9_]*)=", rest_of_line)
      if not (other_fields[0] == "" and len(other_fields) % 2 == 1):
          raise RuntimeError("Could not parse config line.")
      fields += other_fields[1:]
      num_variables = len(fields) // 2
      for i in range(num_variables):
          var_name = fields[i * 2]
          var_value = fields[i * 2 + 1]
          if re.match(r"[a-zA-Z_]", var_name) is None:
              raise RuntimeError(
                  "Expected variable name '{0}' to start with alphabetic character or _, "
                  "in config line {1}".format(
                      var_name, orig_config_line
                  )
              )
          if var_name in ans_dict:
              raise RuntimeError(
                  "Config line has multiply defined variable {0}: {1}".format(
                      var_name, orig_config_line
                  )
              )
          # Teplace any '?' characters that we inserted above, with the original
          # '=' characters.
          # The 'strip()' is to remove initial and final spaces that we might
          # have inserted while processing double-quotes above (search above
          # for the string 'inside_quotes' to see what is meant by this).
          ans_dict[var_name] = var_value.replace("?", "=").strip()
      return (first_token, ans_dict)
  
imports: from __future__ import print_function
  from __future__ import division
  import re
  import sys
label_desc: Use image node_id 11 for calling a global function with example usage: parse_config_line(orig_config_line) and returns: first_token,  ans_dict, None