def METHOD_NAME(url, driver, ident):
    """given a sqlite url + desired driver + ident, make a canonical
    URL out of it
    """
    url = sa_url.make_url(url)
    if driver is None:
        driver = url.get_driver_name()
    filename = url.database
    needs_enc = driver == "pysqlcipher"
    name_token = None
    if filename and filename != ":memory:":
        assert "test_schema" not in filename
        tokens = re.split(r"[_\.]", filename)
        new_filename = f"{driver}"
        for token in tokens:
            if token in _drivernames:
                if driver is None:
                    driver = token
                continue
            elif token in ("db", "enc"):
                continue
            elif name_token is None:
                name_token = token.strip("_")
        assert name_token, f"sqlite filename has no name token: {url.database}"
        new_filename = f"{name_token}_{driver}"
        if ident:
            new_filename += f"_{ident}"
        new_filename += ".db"
        if needs_enc:
            new_filename += ".enc"
        url = url.set(database=new_filename)
    if needs_enc:
        url = url.set(password="test")
    url = url.set(drivername="sqlite+%s" % (driver,))
    return url