'Runs the main interactive command loop.
:param intro: Initial text banner to display instead of the
default.  Make sure you newline terminate it.'

def cmdloop(self, intro=None):

    if (intro is None):
        intro = ('\nSQLite    version    %s    (APSW    %s)\nEnter    ".help"    for    instructions\nEnter    SQL    statements    terminated    with    a    ";"\n' % (apsw.sqlitelibversion(), apsw.apswversion()))
        intro = intro.lstrip()
    if (self.interactive and intro):
        if (sys.version_info < (3, 0)):
            intro = unicode(intro)
        c = self.colour
        self.write(self.stdout, ((c.intro + intro) + c.intro_))
    using_readline = False
    try:
        if (self.interactive and (self.stdin is sys.stdin)):
            import readline
            old_completer = readline.get_completer()
            readline.set_completer(self.complete)
            readline.parse_and_bind('tab:    complete')
            using_readline = True
            try:
                readline.read_history_file(os.path.expanduser(self.history_file))
            except:
                pass
    except ImportError:
        pass
    try:
        while True:
            self._input_descriptions = []
            if using_readline:
                self._completion_cache = None
                self._using_readline = True
            try:
                command = self.getcompleteline()
                if (command is None):
                    return
                self.process_complete_line(command)
            except:
                self._append_input_description()
                try:
                    self.handle_exception()
                except UnicodeDecodeError:
                    self.handle_exception()
    finally:
        if using_readline:
            readline.set_completer(old_completer)
            readline.set_history_length(256)
            readline.write_history_file(os.path.expanduser(self.history_file))
