class_docstr: Parse HOCON files: https://github.com/typesafehub/config/blob/master/HOCON.md
class_docstr_tok: ["Parse","HOCON","files",":","https",":","\/\/github.com\/typesafehub\/config\/blob\/master\/HOCON.md"]
docstr: :param config:
  :param substitution:
  :return: (is_resolved, resolved_variable)
docstr_tok: [":","param","config",":",":","param","substitution",":",":","return",":","(","is_resolved",",","resolved_variable",")"]
code: def _resolve_variable(cls, config, substitution):
      """
      :param config:
      :param substitution:
      :return: (is_resolved, resolved_variable)
      """
      variable = substitution.variable
      try:
          return True, config.get(variable)
      except ConfigMissingException:
          # default to environment variable
          value = os.environ.get(variable)
  
          if value is None:
              if substitution.optional:
                  return False, None
              else:
                  raise ConfigSubstitutionException(
                      "Cannot resolve variable ${{{variable}}} (line: {line}, col: {col})".format(
                          variable=variable,
                          line=lineno(
                              substitution.loc, substitution.instring
                          ),
                          col=col(
                              substitution.loc, substitution.instring
                          ),
                      )
                  )
          elif isinstance(value, ConfigList) or isinstance(
              value, ConfigTree
          ):
              raise ConfigSubstitutionException(
                  "Cannot substitute variable ${{{variable}}} because it does not point to a "
                  "string, int, float, boolean or null {type} (line:{line}, col: {col})".format(
                      variable=variable,
                      type=value.__class__.__name__,
                      line=lineno(
                          substitution.loc, substitution.instring
                      ),
                      col=col(substitution.loc, substitution.instring),
                  )
              )
          return True, value
  
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 3 for calling the ConfigParser obj's underlying member method code with example usage: obj._resolve_variable(cls, config, substitution) and returns: True,  config, True,  value, False,  None