input: Write a function in Python that checks if it is possible to sort an array in non-decreasing order by performing any number of right shift operations on the array. If it is possible, return True; otherwise, return False. If the array is empty, return True.
  
  def can_sort_by_shifts(arr):
      if not arr:
          return True
      n = len(arr)
      pivot = 0
      while pivot < n:
          if arr[pivot] > arr[(pivot+1)%n]:
              break
          pivot += 1
      if pivot == n:
          return True
      for i in range(1, n):
          if arr[(pivot+i)%n] > arr[(pivot+i+1)%n]:
              return False
      return True
  
  assert can_sort_by_shifts([3, 4, 5, 1, 2])==True
  assert can_sort_by_shifts([3, 5, 10, 1, 2])==True
  assert can_sort_by_shifts([4, 3, 1, 2])==False
  assert can_sort_by_shifts([3, 5, 4, 1, 2])==False
  assert can_sort_by_shifts([])==True
output: def can_sort_by_shifts(arr):
      if not arr:
          return True
      n = len(arr)
      pivot = 0
      while pivot < n:
          if arr[pivot] > arr[(pivot+1)%n]:
              break
          pivot += 1
      if pivot == n:
          return True
      for i in range(1, n):
          if arr[(pivot+i)%n] > arr[(pivot+i+1)%n]:
              return False
      return True