class_docstr: Configure logging using a dictionary-like object to describe the
  configuration.
class_docstr_tok: ["Configure","logging","using","a","dictionary-like","object","to","describe","the","configuration","."]
docstr: Configure a formatter from a dictionary.
docstr_tok: ["Configure","a","formatter","from","a","dictionary","."]
code: def configure_formatter(self, config):
      """Configure a formatter from a dictionary."""
      if "()" in config:
          factory = config["()"]  # for use in exception handler
          try:
              result = self.configure_custom(config)
          except TypeError as te:
              if "'format'" not in str(te):
                  raise
              # Name of parameter changed from fmt to format.
              # Retry with old name.
              # This is so that code can be used with older Python versions
              # (e.g. by Django)
              config["fmt"] = config.pop("format")
              config["()"] = factory
              result = self.configure_custom(config)
      else:
          fmt = config.get("format", None)
          dfmt = config.get("datefmt", None)
          style = config.get("style", "%")
          cname = config.get("class", None)
          defaults = config.get("defaults", None)
  
          if not cname:
              c = logging.Formatter
          else:
              c = _resolve(cname)
  
          kwargs = {}
  
          # Add defaults only if it exists.
          # Prevents TypeError in custom formatter callables that do not
          # accept it.
          if defaults is not None:
              kwargs["defaults"] = defaults
  
          # A TypeError would be raised if "validate" key is passed in with a formatter callable
          # that does not accept "validate" as a parameter
          if (
              "validate" in config
          ):  # if user hasn't mentioned it, the default will be fine
              result = c(fmt, dfmt, style, config["validate"], **kwargs)
          else:
              result = c(fmt, dfmt, style, **kwargs)
  
      return result
  
imports: import errno
  import functools
  import io
  import logging
  import logging.handlers
  import os
  import queue
  import re
  import struct
  import threading
  import traceback
  from socketserver import ThreadingTCPServer, StreamRequestHandler
label_desc: Use image node_id 2 for calling the DictConfigurator obj's underlying member method code with example usage: obj.configure_formatter(config) and returns: result