def _credit_card(self):
        """Return the credit card associated with this payment."""
        from payment.models import CreditCardDetail
        for payment in self.payments.order_by('-time_stamp'):
            try:
                if payment.creditcards.count() > 0:
                    return payment.creditcards.get()
            except CreditCardDetail.DoesNotExist:
                pass
        return None
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_store/shop/models.py/Order._credit_card/original