class_docstr: A string class for supporting $-substitutions.
code: def substitute(self, mapping=_sentinel_dict, /, **kws):
      if mapping is _sentinel_dict:
          mapping = kws
      elif kws:
          mapping = _ChainMap(kws, mapping)
  
      # Helper function for .sub()
      def convert(mo):
          # Check the most common path first.
          named = mo.group("named") or mo.group("braced")
          if named is not None:
              return str(mapping[named])
          if mo.group("escaped") is not None:
              return self.delimiter
          if mo.group("invalid") is not None:
              self._invalid(mo)
          raise ValueError(
              "Unrecognized named group in pattern", self.pattern
          )
  
      return self.pattern.sub(convert, self.template)
  
imports: import _string
  import re
  from collections import ChainMap
label_desc: Use image node_id 4 for calling the Template obj's underlying member method code with example usage: obj.substitute() and returns: self, str, self