def IfThenElse(condition, val_if_true, val_if_false):
    """Ternary conditional function: return either *val_if_true* or
    *val_if_false* depending on *condition*.

    Example
    -------
    Here in a parameter definition (assuming that ``summer_period`` is
    defined e.g. in the *calendars* section of the model)::

      average_temperature:
        desc: 'average temperature for the season'
        value: 'IfThenElse(summer_period, 25, 8)'

    Parameters
    ----------
    condition: bool
        a boolean expression
    val_if_true: number
        value to return if the expression is True
    val_if_false: number
        value to return if the expression is False

    Returns
    -------
    number:
        One of the two values, depending on *condition*.

    """
    return val_if_true if condition else val_if_false
