def handle_pr(handler, addr, post):
    """Handle pr POST request."""
    logger.log(logging.DEBUG, "Pr request to %s from %s:%d",
               handler.path, *addr)
    logger.log(logging.DEBUG, "%s", post)

    words = len(post["words"].split('\t'))
    wordsret = "0" * words
    ret = {
        "prwords": wordsret,
        "returncd": "000",
        "datetime": time.strftime("%Y%m%d%H%M%S")
    }

    for l in "ACEJKP":
        ret["prwords" + l] = wordsret

    handler.send_response(200)
    handler.send_header("Content-type", "text/plain")
    handler.send_header("NODE", "wifiappe1")

    logger.log(logging.DEBUG, "Pr response to %s:%d", *addr)
    logger.log(logging.DEBUG, "%s", ret)

    return utils.dict_to_qs(ret)
def handle_ac(handler, addr, post):
    """Handle ac POST request."""
    logger.log(logging.DEBUG, "Ac request to %s from %s:%d",
               handler.path, *addr)
    logger.log(logging.DEBUG, "%s", post)

    action = str(post["action"]).lower()
    command = handler.ac_actions.get(action, handle_ac_action)
    ret = command(handler, gs_database.GamespyDatabase(), addr, post)

    ret.update({"datetime": time.strftime("%Y%m%d%H%M%S")})
    handler.send_response(200)
    handler.send_header("Content-type", "text/plain")
    handler.send_header("NODE", "wifiappe1")

    return utils.dict_to_qs(ret)