class_docstr: (openai<1) A class for OpenAI completion API.
  
  It also supports: ChatCompletion, Azure OpenAI API.
code: def instantiate(
      cls,
      template: Union[str, None],
      context: Optional[Dict] = None,
      allow_format_str_template: Optional[bool] = False,
  ):
      if not context or template is None:
          return template
      if isinstance(template, str):
          return (
              template.format(**context)
              if allow_format_str_template
              else template
          )
      return template(context)
  
imports: from time import sleep
  import logging
  import time
  from typing import List, Optional, Dict, Callable, Union
  import sys
  import shutil
  import numpy
  from flaml import tune, BlendSearch
  from flaml.tune.space import is_constant
  from flaml.automl.logger import logger_formatter
  from .openai_utils import get_key
  from collections import defaultdict
label_desc: Use image node_id 14 for calling the Completion obj's underlying member method code with example usage: obj.instantiate(cls, template, context, allow_format_str_template) and returns: template, template, unknown