'Restore saved user-defined command
Args:
- cmd: user-defined command (String)
Returns:
- True if success to restore (Bool)'

def restore_user_command(self, cmd):

    if (cmd == 'all'):
        commands = '\n'.join(self.SAVED_COMMANDS.values())
        self.SAVED_COMMANDS = {}
    elif (cmd not in self.SAVED_COMMANDS):
        return False
    else:
        commands = self.SAVED_COMMANDS[cmd]
        self.SAVED_COMMANDS.pop(cmd)
    tmp = tmpfile()
    tmp.write(commands)
    tmp.flush()
    result = self.execute(('source    %s' % tmp.name))
    tmp.close()
    return result
