Write code to reverse an array without using another array. Implement the reversal in place, modifying the provided array and using only constant extra space. Define reverse_array(arr) to return the reversed array after mutation; support empty, single-element, and duplicate-value arrays.
def reverse_array(arr):