def switch(*args):
    """
    Given each arg as a tuple (b, e) returns the first match. This is equivalent to
    if b1:
        return e1
    elif b2:
        :return e2
        ...
    :param args: are in the form ((b1, e1), (b2, e2) ...)
    :return: one of the e
    """

    for b, e in args:
        if b:
            return e