def update_to_valid_payment_method(request, customer, save=False):
    valid_sms = get_valid_payment_methods(request)

    if customer.selected_payment_method not in valid_sms:
        customer.selected_payment_method = get_default_payment_method(request)
        if save:
            customer.save()
After this method has been called the given customer has a valid payment
dataset/ETHPy150Open diefenbach/django-lfs/lfs/payment/utils.py/update_to_valid_payment_method