class_docstr: Parse a config tree from tokens
class_docstr_tok: ["Parse","a","config","tree","from","tokens"]
docstr: Create ConfigTree from tokens
  
  :param instring:
  :param loc:
  :param token_list:
  :return:
docstr_tok: ["Create","ConfigTree","from","tokens",":","param","instring",":",":","param","loc",":",":","param","token_list",":",":","return",":"]
code: def postParse(self, instring, loc, token_list):
      """Create ConfigTree from tokens
  
      :param instring:
      :param loc:
      :param token_list:
      :return:
      """
      config_tree = ConfigTree(root=self.root)
      for element in token_list:
          expanded_tokens = (
              element.tokens
              if isinstance(element, ConfigInclude)
              else [element]
          )
  
          for tokens in expanded_tokens:
              # key, value1 (optional), ...
              key = (
                  tokens[0].strip()
                  if isinstance(tokens[0], (unicode, basestring))
                  else tokens[0]
              )
              operator = "="
              if len(tokens) == 3 and tokens[1].strip() in [
                  ":",
                  "=",
                  "+=",
              ]:
                  operator = tokens[1].strip()
                  values = tokens[2:]
              elif len(tokens) == 2:
                  values = tokens[1:]
              else:
                  raise ParseSyntaxException(
                      "Unknown tokens {tokens} received".format(
                          tokens=tokens
                      )
                  )
              # empty string
              if len(values) == 0:
                  config_tree.put(key, "")
              else:
                  value = values[0]
                  if isinstance(value, list) and operator == "+=":
                      value = ConfigValues(
                          [
                              ConfigSubstitution(
                                  key, True, "", False, loc
                              ),
                              value,
                          ],
                          False,
                          loc,
                      )
                      config_tree.put(key, value, False)
                  elif isinstance(value, unicode) and operator == "+=":
                      value = ConfigValues(
                          [
                              ConfigSubstitution(
                                  key, True, "", True, loc
                              ),
                              " " + value,
                          ],
                          True,
                          loc,
                      )
                      config_tree.put(key, value, False)
                  elif isinstance(value, list):
                      config_tree.put(key, value, False)
                  else:
                      existing_value = config_tree.get(key, None)
                      if isinstance(
                          value, ConfigTree
                      ) and not isinstance(existing_value, list):
                          # Only Tree has to be merged with tree
                          config_tree.put(key, value, True)
                      elif isinstance(value, ConfigValues):
                          conf_value = value
                          value.parent = config_tree
                          value.key = key
                          if isinstance(
                              existing_value, list
                          ) or isinstance(existing_value, ConfigTree):
                              config_tree.put(key, conf_value, True)
                          else:
                              config_tree.put(key, conf_value, False)
                      else:
                          config_tree.put(key, value, False)
      return config_tree
  
imports: import itertools
  import re
  import os
  import socket
  import contextlib
  import codecs
  from datetime import timedelta
  from pyparsing import Forward, Keyword, QuotedString, Word, Literal, Suppress, Regex, Optional, SkipTo, ZeroOrMore, Group, lineno, col, TokenConverter, replaceWith, alphanums, alphas8bit, ParseSyntaxException, StringEnd
  from pyparsing import ParserElement
  from .config_tree import ConfigTree, ConfigSubstitution, ConfigList, ConfigValues, ConfigUnquotedString, ConfigInclude, NoneValue, ConfigQuotedString
  from .exceptions import ConfigSubstitutionException, ConfigMissingException, ConfigException
  import logging
  import copy
label_desc: Use image node_id 2 for calling the ConfigTreeParser obj's underlying member method code with example usage: obj.postParse(instring, loc, token_list) and returns: config_tree