input: Write a function to convert an SQL query into its equivalent Python code using the sqlite3 module. The function should accept a SQL query as a string and a database file name as parameters, and return the result of the query as a list of tuples. If the query is executed successfully, the function should print each row of the result. If the database file does not exist or the query is invalid, an appropriate error message should be returned.
  assert sql_to_python("SELECT * FROM Movies WHERE category = 'horror'", 'movies.db')==[('Movie1', 'horror'), ('Movie2', 'horror')]
  assert sql_to_python("SELECT * FROM Movies", 'movies.db')==[('Movie1', 'horror'), ('Movie2', 'horror'), ('Movie3', 'action')]
  assert sql_to_python("SELECT * FROM NonExistentTable", 'movies.db')=="Table not found"
  assert sql_to_python("SELECT * FROM Movies WHERE category = 'action'", 'nonexistent.db')=="Database not found"
output: def sql_to_python(query, db_file):
      try:
          import sqlite3
          conn = sqlite3.connect(db_file)
          cursor = conn.cursor()
          cursor.execute(query)
          result = cursor.fetchall()
          for row in result:
              print(row)
          conn.close()
          return result
      except sqlite3.OperationalError as e:
          if "no such table" in str(e):
              return "Table not found"
          else:
              return str(e)
      except sqlite3.Error:
          return "Database not found"