class_docstr: Extension of the completer class with IPython-specific features
class_docstr_tok: ["Extension","of","the","completer","class","with","IPython-specific","features"]
code: def dispatch_custom_completer(self, text):
      if not self.custom_completers:
          return
  
      line = self.line_buffer
      if not line.strip():
          return None
  
      # Create a little structure to pass all the relevant information about
      # the current completion to any custom completer.
      event = Bunch()
      event.line = line
      event.symbol = text
      cmd = line.split(None, 1)[0]
      event.command = cmd
      event.text_until_cursor = self.text_until_cursor
  
      # for foo etc, try also to find completer for %foo
      if not cmd.startswith(self.magic_escape):
          try_magic = self.custom_completers.s_matches(
              self.magic_escape + cmd
          )
      else:
          try_magic = []
  
      for c in itertools.chain(
          self.custom_completers.s_matches(cmd),
          try_magic,
          self.custom_completers.flat_matches(self.text_until_cursor),
      ):
          try:
              res = c(event)
              if res:
                  # first, try case sensitive match
                  withcase = [
                      cast_unicode_py2(r)
                      for r in res
                      if r.startswith(text)
                  ]
                  if withcase:
                      return withcase
                  # if none, then case insensitive ones are ok too
                  text_low = text.lower()
                  return [
                      cast_unicode_py2(r)
                      for r in res
                      if r.lower().startswith(text_low)
                  ]
          except TryNext:
              pass
          except KeyboardInterrupt:
              """
              If custom completer take too long,
              let keyboard interrupt abort and return nothing.
              """
              break
  
      return None
  
imports: from __future__ import print_function
  import __main__
  import glob
  import inspect
  import itertools
  import keyword
  import os
  import re
  import sys
  import unicodedata
  import string
  import warnings
  from traitlets.config.configurable import Configurable
  from IPython.core.error import TryNext
  from IPython.core.inputsplitter import ESC_MAGIC
  from IPython.core.latex_symbols import latex_symbols, reverse_latex_symbol
  from IPython.utils import generics
  from IPython.utils.decorators import undoc
  from IPython.utils.dir2 import dir2, get_real_method
  from IPython.utils.process import arg_split
  from IPython.utils.py3compat import builtin_mod, string_types, PY3, cast_unicode_py2
  from traitlets import Bool, Enum, observe
label_desc: Use image node_id 16 for calling the IPCompleter obj's underlying member method code with example usage: obj.dispatch_custom_completer(text) and returns: None, None, unknown, withcase