class_docstr: :class:`KernelProvisionerFactory` is responsible for creating provisioner instances.
  
  A singleton instance, `KernelProvisionerFactory` is also used by the :class:`KernelSpecManager`
  to validate `kernel_provisioner` references found in kernel specifications to confirm their
  availability (in cases where the kernel specification references a kernel provisioner that has
  not been installed into the current Python environment).
  
  It's ``default_provisioner_name`` attribute can be used to specify the default provisioner
  to use when a kernel_spec is found to not reference a provisioner.  It's value defaults to
  `"local-provisioner"` which identifies the local provisioner implemented by
  :class:`LocalProvisioner`.
class_docstr_tok: [":","class",":","`","KernelProvisionerFactory","`","is","responsible","for","creating","provisioner","instances",".","A","singleton","instance",",","`","KernelProvisionerFactory","`","is","also","used","by","the",":","class",":","`","KernelSpecManager","`","to","validate","`","kernel_provisioner","`","references","found","in","kernel","specifications","to","confirm","their","availability","(","in","cases","where","the","kernel","specification","references","a","kernel","provisioner","that","has","not","been","installed","into","the","current","Python","environment",")",".","It","'s","``","default_provisioner_name","``","attribute","can","be","used","to","specify","the","default","provisioner","to","use","when","a","kernel_spec","is","found","to","not","reference","a","provisioner",".","It","'s","value","defaults","to","`","``","local-provisioner","''","`","which","identifies","the","local","provisioner","implemented","by",":","class",":","`","LocalProvisioner","`","."]
docstr: Return the kernel_provisioner stanza from the kernel_spec.
  
  Checks the kernel_spec's metadata dictionary for a kernel_provisioner entry.
  If found, it is returned, else one is created relative to the DEFAULT_PROVISIONER
  and returned.
  
  Parameters
  ----------
  kernel_spec : Any - this is a KernelSpec type but listed as Any to avoid circular import
      The kernel specification object from which the provisioner dictionary is derived.
  
  Returns
  -------
  dict
      The provisioner portion of the kernel_spec.  If one does not exist, it will contain
      the default information.  If no `config` sub-dictionary exists, an empty `config`
      dictionary will be added.
docstr_tok: ["Return","the","kernel_provisioner","stanza","from","the","kernel_spec",".","Checks","the","kernel_spec","'s","metadata","dictionary","for","a","kernel_provisioner","entry",".","If","found",",","it","is","returned",",","else","one","is","created","relative","to","the","DEFAULT_PROVISIONER","and","returned",".","Parameters","--","--","--","--","--","kernel_spec",":","Any","-","this","is","a","KernelSpec","type","but","listed","as","Any","to","avoid","circular","import","The","kernel","specification","object","from","which","the","provisioner","dictionary","is","derived",".","Returns","--","--","--","-","dict","The","provisioner","portion","of","the","kernel_spec",".","If","one","does","not","exist",",","it","will","contain","the","default","information",".","If","no","`","config","`","sub-dictionary","exists",",","an","empty","`","config","`","dictionary","will","be","added","."]
code: def _get_provisioner_config(self, kernel_spec: Any) -> Dict[str, Any]:
      """
      Return the kernel_provisioner stanza from the kernel_spec.
  
      Checks the kernel_spec's metadata dictionary for a kernel_provisioner entry.
      If found, it is returned, else one is created relative to the DEFAULT_PROVISIONER
      and returned.
  
      Parameters
      ----------
      kernel_spec : Any - this is a KernelSpec type but listed as Any to avoid circular import
          The kernel specification object from which the provisioner dictionary is derived.
  
      Returns
      -------
      dict
          The provisioner portion of the kernel_spec.  If one does not exist, it will contain
          the default information.  If no `config` sub-dictionary exists, an empty `config`
          dictionary will be added.
      """
      env_provisioner = kernel_spec.metadata.get(
          "kernel_provisioner", {}
      )
      if (
          "provisioner_name" in env_provisioner
      ):  # If no provisioner_name, return default
          if (
              "config" not in env_provisioner
          ):  # if provisioner_name, but no config stanza, add one
              env_provisioner.update({"config": {}})
          return env_provisioner  # Return what we found (plus config stanza if necessary)
      return {
          "provisioner_name": self.default_provisioner_name,
          "config": {},
      }
  
file_path: catboost/contrib/python/jupyter-client/py3/jupyter_client/provisioning/factory.py
imports: import glob
  import sys
  from os import getenv, path
  from typing import Any, Dict, List
  from traitlets.config import SingletonConfigurable, Unicode, default
  from .provisioner_base import KernelProvisionerBase
label_desc: Use image node_id 6 for calling the KernelProvisionerFactory obj's underlying member method code with example usage: obj._get_provisioner_config(kernel_spec) and returns: dict, env_provisioner