def preloop(self):
        ''' Keep persistent command history. '''
        if not self.already_prelooped:
            self.already_prelooped = True
            open('.psiturk_history', 'a').close()  # create file if it doesn't exist
            readline.read_history_file('.psiturk_history')
            for i in range(readline.get_current_history_length()):
                if readline.get_history_item(i) is not None:
                    self.history.append(readline.get_history_item(i))
Keep persistent command history.