input: Write a function to re-write a given SQL query in Python. The function should accept the SQL query as a string and return the corresponding Python code as a string. The Python code should include connecting to a SQLite database, executing the query, fetching the results, and printing each row. If the input query is empty, the function should return None.
  
  assert rewrite_sql_in_python("SELECT * FROM Movies WHERE category = 'horror'")=='''import sqlite3
  
  conn = sqlite3.connect('movies.db') 
  cursor = conn.cursor()
  
  cursor.execute("SELECT * FROM Movies WHERE category = 'horror'")
  
  result = cursor.fetchall()
  for row in result:
      print(row)
  
  conn.close()'''
  
  assert rewrite_sql_in_python("")==None
output: def rewrite_sql_in_python(query):
      if not query:
          return None
      return f'''import sqlite3
  
  conn = sqlite3.connect('movies.db') 
  cursor = conn.cursor()
  
  cursor.execute("{query}")
  
  result = cursor.fetchall()
  for row in result:
      print(row)
  
  conn.close()'''