Could you code the inversion of a binary tree in your preferred programming language?

Free for the first 3 answer contributors

Interview question asked to Machine Learning Engineers interviewing at GoCardless, Tinder, Honeywell and others: Could you code the inversion of a binary tree in your preferred programming language?.