def get_contest_id(gt_id, horizon):
    """Returns contest task identifier string for the given ground truth
    identifier and horizon identifier

    Args:
       gt_id: ground truth data string ending in "precip" or "tmp2m" or
          belonging to {"prate", "apcp", "temp"}
       horizon: string in {"34w","56w","week34","week56"} indicating target
          horizon for prediction
    """
    # Map gt_id to standard contest form
    if gt_id.endswith("tmp2m") or gt_id == "temp":
        gt_id = "temp"
    elif gt_id.endswith("precip") or gt_id == "apcp" or gt_id == "prate":
        gt_id = "apcp"
    else:
        raise ValueError("Unrecognized gt_id "+gt_id)
    # Map horizon to standard contest form
    if horizon == "34w" or horizon == "week34":
        horizon = "week34"
    elif horizon == "56w" or horizon == "week56":
        horizon = "week56"
    else:
        raise ValueError("Unrecognized horizon "+horizon)
    # Return contest task identifier
    return gt_id+"_"+horizon