def if_then_else(cond, trueval, falseval):
    """
    Returns one of two values depending on choice bit
    :param cond: Choice bit (function does not ensure that this is a bit)
    :param trueval: Value if choice bit is 1
    :param falseval: Value if choice bit is 0
    :return: Value given by choice bit
    """

    return falseval+cond*(trueval-falseval)