def last(seq, pred=None):
    """Return the last item in seq for which the predicate is true.
    
    If the predicate is None, return the last item regardless of value.

    If no items satisfy the predicate, return None.
    """
    if pred is None:
        pred = lambda x: True
    for item in reversed(seq):
        if pred(item):
            return item
    return None
Return the last item in seq for which the predicate is true.
    
    If the predicate is None, return the last item regardless of value.

    If no items satisfy the predicate, return None.
    
recipes/Python/438810_First_last_item_access_predicates_increase/recipe-438810.py