Silicon Valley Bank may need to rotate an in-memory sequence of transaction batches before processing a new reporting window. Given an array nums, rotate its elements to the right by k positions and modify the array in place.
Implement rotate_right(nums, k), where nums is a mutable array of integers and k is a non-negative integer. The function must rearrange nums so that each element moves k positions to the right, wrapping around at the end. Return the modified array. Do not create an array proportional to nums.length.
def rotate_right(nums, k):