def contests():
    """
        Show the upcoming contests
    """

    today = datetime.datetime.today()
    today = datetime.datetime.strptime(str(today)[:-7],
                                       "%Y-%m-%d %H:%M:%S")

    start_date = today.date()
    end_date = start_date + datetime.timedelta(90)
    url = "https://contesttrackerapi.herokuapp.com/"
    response = requests.get(url)
    if response.status_code == 200:
        response = response.json()["result"]
    else:
        # @todo: something better
        return dict()

    ongoing = response["ongoing"]
    upcoming = response["upcoming"]
    contests = []
    cal = pdt.Calendar()

    table = TABLE(_class="centered striped")
    thead = THEAD(TR(TH("Contest Name"),
                     TH("Site"),
                     TH("Start"),
                     TH("Duration/Ending"),
                     TH("Link"),
                     TH("Add Reminder")))
    table.append(thead)
    tbody = TBODY()

    for i in ongoing:

        if ("TOPCODER", "OTHER") in i["Platform"]:
            continue

        try:
            endtime = datetime.datetime.strptime(i["EndTime"],
                                                 "%a, %d %b %Y %H:%M")
        except ValueError:
            continue
        tr = TR()
        span = SPAN(_class="green tooltipped",
                    data={"position": "right",
                          "delay": "50",
                          "tooltip": "Live Contest"},
                    _style="cursor: pointer; " + \
                            "float:right; " + \
                            "height:10px; " + \
                            "width:10px; " + \
                            "border-radius: 50%;")
        tr.append(TD(i["Name"], span))
        tr.append(TD(i["Platform"].capitalize()))
        tr.append(TD("-"))
        tr.append(TD(str(endtime).replace("-", "/"),
                     _class="contest-end-time"))
        tr.append(TD(A(I(_class="fa fa-external-link-square fa-lg"),
                       _class="btn-floating btn-small green accent-4 tooltipped",
                       _href=i["url"],
                       data={"position": "left",
                             "tooltip": "Contest Link",
                             "delay": "50"},
                       _target="_blank")))
        tr.append(TD(BUTTON(I(_class="fa fa-calendar-plus-o"),
                            _class="btn-floating btn-small orange accent-4 tooltipped disabled",
                            data={"position": "left",
                                  "tooltip": "Already started!",
                                  "delay": "50"})))
        tbody.append(tr)

    # This id is used for uniquely identifying
    # a particular contest in js
    button_id = 1
    for i in upcoming:

        if i["Platform"] in ("TOPCODER", "OTHER"):
            continue

        start_time = datetime.datetime.strptime(i["StartTime"],
                                                "%a, %d %b %Y %H:%M")
        tr = TR(_id="contest-" + str(button_id))
        tr.append(TD(i["Name"]))
        tr.append(TD(i["Platform"].capitalize()))
        tr.append(TD(str(start_time)))

        duration = i["Duration"]
        duration = duration.replace(" days", "d")
        duration = duration.replace(" day", "d")
        tr.append(TD(duration))
        tr.append(TD(A(I(_class="fa fa-external-link-square fa-lg"),
                       _class="btn-floating btn-small green accent-4 tooltipped",
                       _href=i["url"],
                       data={"position": "left",
                             "tooltip": "Contest Link",
                             "delay": "50"},
                       _target="_blank")))
        tr.append(TD(BUTTON(I(_class="fa fa-calendar-plus-o"),
                            _class="btn-floating btn-small orange accent-4 tooltipped",
                            data={"position": "left",
                                  "tooltip": "Set Reminder to Google Calendar",
                                  "delay": "50"},
                            _id="set-reminder-" + str(button_id))))
        tbody.append(tr)
        button_id += 1

    table.append(tbody)
    return dict(table=table, upcoming=upcoming)

# ------------------------------------------------------------------------------
dataset/ETHPy150Open stopstalk/stopstalk-deployment/controllers/default.py/contests/swapped operands of `in`