'Create a new completer for the command line.
Completer([namespace]) -> completer instance.
If unspecified, the default namespace where completions are performed
is __main__ (technically, __main__.__dict__). Namespaces should be
given as dictionaries.
Completer instances should be used as the completion mechanism of
readline via the set_completer() call:
readline.set_completer(Completer(my_namespace).complete)'

def __init__(self, namespace=None):

    if (namespace and (not isinstance(namespace, dict))):
        raise TypeError('namespace    must    be    a    dictionary')
    if (namespace is None):
        self.use_main_ns = 1
    else:
        self.use_main_ns = 0
        self.namespace = namespace
