def firstof(seq):
    """Return the first item that is truthy in a sequence.

    Equivalent to Djangos' firstof.

    Args:
        seq (list): A list of values.

    Returns:
        value (mixed): The output, depending on the truthiness of the input.
    """
    if not any(seq):
        return ''
    if all(seq):
        return seq[0]
    while seq:
        item = seq.pop(0)
        if item:
            return item
    return ''