payment.card.last4. Write dig(data, path) where path is a dot-separated string, walking the parsed dict and returning None the moment any level is missing or not a dict — no exceptions raised.dig({'payment': {'card': {'last4': '4242'}}}, 'payment.card.last4')'4242'
Each segment descends one level.
dig({'payment': {}}, 'payment.card.last4')None
The chain breaks quietly at card.
isinstance(current, dict) guards each step.
Return None on the first miss.