def METHOD_NAME(
    dataset: str, user, expected_status: HTTPStatus
) -> requests.Response:
    try:
        dataset_id = Dataset.query(name=dataset).resource_id
    except DatasetNotFound:
        dataset_id = dataset  # Allow passing deliberately bad value
    headers = {"authorization": f"bearer {get_token_func(user)}"}
    response = client.get(
        f"{server_config.rest_uri}/datasets/{dataset_id}/visualize",
        headers=headers,
    )
    assert response.status_code == expected_status
    return response