docstr: Assert and Get Attribute, raise Compiler exception if not found
  
  Args:
      key (str): Attribute Name
      optional (Optional): default is False, if set to true,
                  simple return None when attribute not found
      default (Optional): default value if not found
  
  Returns:
      attribute value
docstr_tok: ["Assert","and","Get","Attribute",",","raise","Compiler","exception","if","not","found","Args",":","key","(","str",")",":","Attribute","Name","optional","(","Optional",")",":","default","is","False",",","if","set","to","true",",","simple","return","None","when","attribute","not","found","default","(","Optional",")",":","default","value","if","not","found","Returns",":","attribute","value"]
code: def assert_attr(self, key: str, *, optional=False, default=None):
      """
      Assert and Get Attribute, raise Compiler exception if not found
  
      Args:
          key (str): Attribute Name
          optional (Optional): default is False, if set to true,
                      simple return None when attribute not found
          default (Optional): default value if not found
  
      Returns:
          attribute value
      """
      if hasattr(self, key):
          return getattr(self, key)
      if optional:
          return None
      if not (default is None):
          return default
      raise CompilerException("attribute '%s' is not defined" % key)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import warnings
  import json
  from enum import Enum
  from importlib import import_module
  from pathlib import Path
  import numpy
  import pandas
  import yaml
  from jsonschema import validate
  from xai.exception import CompilerException
  from xai.formatter import Report
label_desc: Use image node_id 6 for calling the Dict2Obj obj's underlying member method code with example usage: obj.assert_attr(key) and returns: getattr, None, default