def apply(self, basket, condition, offer):
    line_tuples = self.get_applicable_lines(offer, basket)
    if (not line_tuples):
        return ZERO_DISCOUNT
    (discount, line) = line_tuples[0]
    apply_discount(line, discount, 1, offer)
    affected_lines = [(line, discount, 1)]
    condition.consume_items(offer, basket, affected_lines)
    return BasketDiscount(discount)
def apply(self, basket, condition, offer):
    line_tuples = self.get_applicable_lines(offer, basket)
    if (not line_tuples):
        return ZERO_DISCOUNT
    (discount, line) = line_tuples[0]
    apply_discount(line, discount, 1, offer)
    affected_lines = [(line, discount, 1)]
    condition.consume_items(offer, basket, affected_lines)
    return BasketDiscount(discount)