<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

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))