code: def generate_driver_url(url, driver, query_str):
      backend = url.get_backend_name()
  
      new_url = url.set(drivername="%s+%s" % (backend, driver))
  
      if driver not in ("pyodbc", "aioodbc"):
          new_url = new_url.set(query="")
  
      if driver == "aioodbc":
          new_url = new_url.update_query_dict(
              {"MARS_Connection": "Yes"}
          )
  
      if query_str:
          new_url = new_url.update_query_string(query_str)
  
      try:
          new_url.get_dialect()
      except exc.NoSuchModuleError:
          return None
      else:
          return new_url
  
imports: from sqlalchemy import inspect
  from sqlalchemy import Integer
  from ...None import create_engine
  from ...None import exc
  from ...schema import Column
  from ...schema import DropConstraint
  from ...schema import ForeignKeyConstraint
  from ...schema import MetaData
  from ...schema import Table
  from ...testing.provision import create_db
  from ...testing.provision import drop_all_schema_objects_pre_tables
  from ...testing.provision import drop_db
  from ...testing.provision import generate_driver_url
  from ...testing.provision import get_temp_table_name
  from ...testing.provision import log
  from ...testing.provision import normalize_sequence
  from ...testing.provision import run_reap_dbs
  from ...testing.provision import temp_table_keyword_args
label_desc: Use image node_id 1 for calling a global function with example usage: generate_driver_url(url, driver, query_str) and returns: new_url, None