'RiskData' object has no attribute 'device_data_captured' using Python Braintree

For a Customer I created a project using Django. I implemented some RESTful API for Client's mobile apps.

We integrated Braintree to have a Payments Gateway.

Everything worked fine for years.. At the moment, the mobile apps haven't been updated for several months.

Some mouths ago, Server side, we upgraded Python and Django version (as also Braintree SDK to the version 4.5.0) and inexplicably, from 2, 3 days the payments using credit cards getting in fails (using PayPal works fine.

In theory, the money are withdrawn by the Customer cards but the flow mobile-server it's broken now so, server side, I'm not able to complete Braintree transaction flow.

In particular, when I try to call this method to validate the transaction (as described into Braintree documentation)

result = gateway.transaction.sale({
        "amount": orderPrice,
        "order_id": str(order.uuid),
        "payment_method_nonce": nonce_payment,
        "customer": GatewayManager._generateCustomerInfo(order.owner),
        "options": {
            "store_in_vault_on_success": STORE_IN_VAULT_ON_SUCCESS,
            "submit_for_settlement": SUBMIT_FOR_SETTLEMENT,
        }
    })

I obtain this error:

'RiskData' object has no attribute 'device_data_captured'

I'm not able to understand the reason...

Why from some days it's broken? What's we missed or what's we need to do?