input: Write a function to re-write the given SQL query in Python. The function should connect to a SQLite database named 'movies.db', execute the query to retrieve all movies from the 'Movies' table where the category is 'horror', and print each row of the result. The function should then close the connection to the database.
  
  def sql_to_python():
      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 sql_to_python.__name__ == 'sql_to_python'  # Ensures function is named correctly
  assert sql_to_python.__code__.co_argcount == 0  # Ensures function has no parameters
  assert sql_to_python.__code__.co_varnames == ()  # Ensures no local variables are used
  assert 'sqlite3' in sql_to_python.__code__.co_names  # Ensures sqlite3 module is imported
  assert "SELECT * FROM Movies WHERE category = 'horror'" in sql_to_python.__code__.co_consts  # Ensures the SQL query is correctly included
  assert 'conn.close()' in sql_to_python.__code__.co_code.decode('utf-8')  # Ensures connection is closed
output: def sql_to_python():
      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()