def METHOD_NAME(config, prefix="", with_transaction=True):
    """Create a PostgreSQLClient client using settings in the provided config."""
    if sqlalchemy is None:
        message = (
            "PostgreSQL SQLAlchemy dependency missing. "
            "Refer to installation section in documentation."
        )
        raise ImportWarning(message)
    from sqlalchemy.orm import scoped_session, sessionmaker
    from zope.sqlalchemy import invalidate, register
    settings = {**config.get_settings()}
    # Custom Kinto settings, unsupported by SQLAlchemy.
    blacklist = [prefix + setting for setting in BLACKLISTED_SETTINGS]
    filtered_settings = {k: v for k, v in settings.items() if k not in blacklist}
    transaction_per_request = with_transaction and filtered_settings.pop(
        "transaction_per_request", False
    )
    url = filtered_settings[prefix + "url"]
    existing_client = _CLIENTS[transaction_per_request].get(url)
    if existing_client:
        msg = "Reuse existing PostgreSQL connection. " f"Parameters {prefix}* will be ignored."
        warnings.warn(msg)
        return existing_client
    # Initialize SQLAlchemy engine from filtered_settings.
    poolclass_key = prefix + "poolclass"
    filtered_settings.setdefault(
        poolclass_key, ("kinto.core.storage.postgresql." "pool.QueuePoolWithMaxBacklog")
    )
    filtered_settings[poolclass_key] = config.maybe_dotted(filtered_settings[poolclass_key])
    engine = sqlalchemy.engine_from_config(filtered_settings, prefix=prefix, url=url)
    # Initialize thread-safe session factory.
    session_factory = scoped_session(sessionmaker(bind=engine))
    if transaction_per_request:
        # Plug with Pyramid transaction manager
        register(session_factory)
    # Store one client per URI.
    commit_manually = not transaction_per_request
    client = PostgreSQLClient(session_factory, commit_manually, invalidate)
    _CLIENTS[transaction_per_request][url] = client
    return client