Votes on a poll.

def vote(session, nick, pid, response):
    """Votes on a poll."""
    if not response:
        return "You have to vote something!"
    if response == "n" or response == "nay":
        response = "no"
    elif response == "y" or response == "aye":
        response = "yes"
    poll = get_open_poll(session, pid)
    if poll is None:
        return "That poll doesn't exist or isn't active. Use !poll list to see valid polls"
    old_vote = get_response(session, pid, nick)
    if old_vote is None:
        session.add(Poll_responses(pid=pid, response=response, voter=nick))
        return "%s voted %s." % (nick, response)
    else:
        if response == old_vote.response:
            return "You've already voted %s." % response
        else:
            msg = "%s changed their vote from %s to %s." % (nick, old_vote.response, response)
            old_vote.response = response
            return msg