docstr: Create a new completer for the command line.
  
  Completer(namespace=ns, global_namespace=ns2) -> completer instance.
  
  If unspecified, the default namespace where completions are performed
  is __main__ (technically, __main__.__dict__). Namespaces should be
  given as dictionaries.
  
  An optional second namespace can be given.  This allows the completer
  to handle cases where both the local and global scopes need to be
  distinguished.
  
  Completer instances should be used as the completion mechanism of
  readline via the set_completer() call:
  
  readline.set_completer(Completer(my_namespace).complete)
docstr_tok: ["Create","a","new","completer","for","the","command","line",".","Completer","(","namespace=ns",",","global_namespace=ns2",")","-",">","completer","instance",".","If","unspecified",",","the","default","namespace","where","completions","are","performed","is","__main__","(","technically",",","__main__.__dict__",")",".","Namespaces","should","be","given","as","dictionaries",".","An","optional","second","namespace","can","be","given",".","This","allows","the","completer","to","handle","cases","where","both","the","local","and","global","scopes","need","to","be","distinguished",".","Completer","instances","should","be","used","as","the","completion","mechanism","of","readline","via","the","set_completer","(",")","call",":","readline.set_completer","(","Completer","(","my_namespace",")",".complete",")"]
code: def __init__(self, namespace=None, global_namespace=None, **kwargs):
      """Create a new completer for the command line.
  
      Completer(namespace=ns, global_namespace=ns2) -> completer instance.
  
      If unspecified, the default namespace where completions are performed
      is __main__ (technically, __main__.__dict__). Namespaces should be
      given as dictionaries.
  
      An optional second namespace can be given.  This allows the completer
      to handle cases where both the local and global scopes need to be
      distinguished.
  
      Completer instances should be used as the completion mechanism of
      readline via the set_completer() call:
  
      readline.set_completer(Completer(my_namespace).complete)
      """
  
      # Don't bind to namespace quite yet, but flag whether the user wants a
      # specific namespace or to use __main__.__dict__. This will allow us
      # to bind to __main__.__dict__ at completion time, not now.
      if namespace is None:
          self.use_main_ns = 1
      else:
          self.use_main_ns = 0
          self.namespace = namespace
  
      # The global namespace, if given, can be bound directly
      if global_namespace is None:
          self.global_namespace = {}
      else:
          self.global_namespace = global_namespace
  
      super(Completer, self).__init__(**kwargs)
  
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 1 to create a new Completer object from inherited base classes: Configurable with example: obj = Completer(namespace, global_namespace)