class_docstr: Base class for configurable interfaces.
  
  A configurable interface is an (abstract) class whose constructor
  acts as a factory function for one of its implementation subclasses.
  The implementation subclass as well as optional keyword arguments to
  its initializer can be set globally at runtime with `configure`.
  
  By using the constructor as the factory method, the interface
  looks like a normal class, `isinstance` works as usual, etc.  This
  pattern is most useful when the choice of implementation is likely
  to be a global decision (e.g. when `~select.epoll` is available,
  always use it instead of `~select.select`), or when a
  previously-monolithic class has been split into specialized
  subclasses.
  
  Configurable subclasses must define the class methods
  `configurable_base` and `configurable_default`, and use the instance
  method `initialize` instead of ``__init__``.
  
  .. versionchanged:: 5.0
  
     It is now possible for configuration to be specified at
     multiple levels of a class hierarchy.
class_docstr_tok: ["Base","class","for","configurable","interfaces",".","A","configurable","interface","is","an","(","abstract",")","class","whose","constructor","acts","as","a","factory","function","for","one","of","its","implementation","subclasses",".","The","implementation","subclass","as","well","as","optional","keyword","arguments","to","its","initializer","can","be","set","globally","at","runtime","with","`","configure","`",".","By","using","the","constructor","as","the","factory","method",",","the","interface","looks","like","a","normal","class",",","`","isinstance","`","works","as","usual",",","etc",".","This","pattern","is","most","useful","when","the","choice","of","implementation","is","likely","to","be","a","global","decision","(","e.g",".","when","`","~select.epoll","`","is","available",",","always","use","it","instead","of","`","~select.select","`",")",",","or","when","a","previously-monolithic","class","has","been","split","into","specialized","subclasses",".","Configurable","subclasses","must","define","the","class","methods","`","configurable_base","`","and","`","configurable_default","`",",","and","use","the","instance","method","`","initialize","`","instead","of","``","__init__","``",".","..","versionchanged",":",":","5.0","It","is","now","possible","for","configuration","to","be","specified","at","multiple","levels","of","a","class","hierarchy","."]
code: def __new__(cls, *args: Any, **kwargs: Any) -> Any:
      base = cls.configurable_base()
      init_kwargs = {}  # type: Dict[str, Any]
      if cls is base:
          impl = cls.configured_class()
          if base.__impl_kwargs:
              init_kwargs.update(base.__impl_kwargs)
      else:
          impl = cls
      init_kwargs.update(kwargs)
      if impl.configurable_base() is not base:
          # The impl class is itself configurable, so recurse.
          return impl(*args, **init_kwargs)
      instance = super(Configurable, cls).__new__(impl)
      # initialize vs __init__ chosen for compatibility with AsyncHTTPClient
      # singleton magic.  If we get rid of that we can switch to __init__
      # here too.
      instance.initialize(*args, **init_kwargs)
      return instance
  
imports: import array
  import asyncio
  import atexit
  from inspect import getfullargspec
  import os
  import re
  import typing
  import zlib
  from typing import Any, Optional, Dict, Mapping, List, Tuple, Match, Callable, Type, Sequence
label_desc: Use image node_id 1 for calling the Configurable obj's underlying member method code with example usage: obj.__new__(cls) and returns: instance, impl