input: Write a function to rewrite the given JavaScript code in Python. The function should iterate through each element in the array, multiply it by 2, and print the result. If the array is empty, the function should print nothing.
  assert rewrite_code([1, 2, 3, 4, 5])=="""arr = [1, 2, 3, 4, 5]
  
  for item in arr:
   print(item * 2)"""
  assert rewrite_code([])==""
  assert rewrite_code([2, 4, 6])=="""arr = [2, 4, 6]
  
  for item in arr:
   print(item * 2)"""
output: def rewrite_code(arr):
      if not arr:
          return ""
      result = "arr = " + str(arr) + "\n\nfor item in arr:\n print(item * 2)"
      return result