def _is_yearbook_transaction(transaction_detail):
    """Returns True iff the paypal `transaction_detail` object contains an `item_name` of Yearbook.
    """
    cart_info = transaction_detail.get('cart_info')
    if cart_info:
        item_details = cart_info.get('item_details')
        if item_details and len(item_details) == 1:
            item = item_details[0]
            item_name = item.get('item_name', '').lower()
            return item_name and item_name.find('yearbook') != -1

    transaction_info = transaction_detail.get('transaction_info')
    if transaction_info:
        invoice_id = transaction_info.get('invoice_id', '').lower()
        return invoice_id and invoice_id.find('yearbook-invoice') != -1

    return False