def invert_binary_tree_recursive(tree):
    """Recursive implementation of the binary tree inversion algorithm"""

    if not tree:
        return

    invert_binary_tree_recursive(tree.left)
    invert_binary_tree_recursive(tree.right)

    tree.left, tree.right = tree.right, tree.left
    return tree