input: Write a function to convert a SQL query into its equivalent Python code using the sqlite3 library. The function should take a SQL query as input and return the corresponding Python code as a string. If the given SQL query is empty, return an empty string.
  assert sql_to_python("SELECT * FROM Movies WHERE category = 'horror';")=="import sqlite3\n\nconn = sqlite3.connect('movies.db')\ncursor = conn.cursor()\ncursor.execute(\"SELECT * FROM Movies WHERE category = 'horror'\")\n\nresult = cursor.fetchall()\nfor row in result:\n    print(row)\n\nconn.close()"
  assert sql_to_python("SELECT title, year FROM Movies WHERE year > 2000;")=="import sqlite3\n\nconn = sqlite3.connect('movies.db')\ncursor = conn.cursor()\ncursor.execute(\"SELECT title, year FROM Movies WHERE year > 2000\")\n\nresult = cursor.fetchall()\nfor row in result:\n    print(row)\n\nconn.close()"
  assert sql_to_python("")==""
  assert sql_to_python("INSERT INTO Movies (title, year) VALUES ('The Matrix', 1999);")=="import sqlite3\n\nconn = sqlite3.connect('movies.db')\ncursor = conn.cursor()\ncursor.execute(\"INSERT INTO Movies (title, year) VALUES ('The Matrix', 1999)\")\n\nconn.commit()\nconn.close()"
  assert sql_to_python("DELETE FROM Movies WHERE title = 'The Matrix';")=="import sqlite3\n\nconn = sqlite3.connect('movies.db')\ncursor = conn.cursor()\ncursor.execute(\"DELETE FROM Movies WHERE title = 'The Matrix'\")\n\nconn.commit()\nconn.close()"
output: def sql_to_python(sql_query):
      if not sql_query:
          return ""
      if sql_query.strip().lower().startswith("select"):
          return f"import sqlite3\n\nconn = sqlite3.connect('movies.db')\ncursor = conn.cursor()\ncursor.execute(\"{sql_query}\")\n\nresult = cursor.fetchall()\nfor row in result:\n    print(row)\n\nconn.close()"
      else:
          return f"import sqlite3\n\nconn = sqlite3.connect('movies.db')\ncursor = conn.cursor()\ncursor.execute(\"{sql_query}\")\n\nconn.commit()\nconn.close()"