input: Write a function to convert the given SQL query into a Python program that connects to a database, executes the query, and prints the results. If the connection details are provided, the function should return the output as a list of tuples. If the connection details are not provided, the function should return a string indicating the absence of connection details.
  
  def convert_sql_to_python(connection_details=None):
      if connection_details is None:
          return "Connection details are required to execute the query."
  
      import datetime, pyodbc
  
      # Establish a connection to the database
      conn = pyodbc.connect(connection_details)
      cursor = conn.cursor()
  
      # Get the year of the order date
      sql = "SELECT * FROM orders"
      query_date = datetime.date.today().year
      where_clause = "WHERE YEAR(order_date) = ?"
  
      # Execute the query
      cursor.execute(sql + " " + where_clause, query_date)
      results = cursor.fetchall()
  
      # Close the connection
      cursor.close()
      conn.close()
  
      return results
  
  assert convert_sql_to_python("DRIVER={SQL Server};SERVER=server_name;DATABASE=db_name;UID=username;PWD=password") == "[\n(1, '2020-03-15', ...),\n(2, '2020-05-22', ...), \n...\n]"
  assert convert_sql_to_python() == "Connection details are required to execute the query."
output: def convert_sql_to_python(connection_details=None):
      if connection_details is None:
          return "Connection details are required to execute the query."
  
      import datetime, pyodbc
  
      conn = pyodbc.connect(connection_details)
      cursor = conn.cursor()
  
      sql = "SELECT * FROM orders"
      query_date = datetime.date.today().year
      where_clause = "WHERE YEAR(order_date) = ?"
  
      cursor.execute(sql + " " + where_clause, query_date)
      results = cursor.fetchall()
  
      cursor.close()
      conn.close()
  
      return results