def METHOD_NAME(url, driver, query_str):
    backend = url.get_backend_name()
    new_url = url.set(drivername="%s+%s" % (backend, driver))
    if driver != "pyodbc":
        new_url = new_url.set(query="")
    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