def METHOD_NAME(
    tmp_path: Path,
    prefix: Optional[str],
    require_secrets: bool,
) -> storage.GCSStorageManager:
    """
    Skip when we have no gcs access, unless --require-secrets was set, in which case fail.
    Note that if you normally have GCS access to the bucket in question and you have done the usual
    login with the gcloud cli tool, no environment variables are necessary to run this test locally.
    """
    # Instantiating a google.cloud.storage.Client() takes a few seconds, so we speed up test by
    # reusing the one created for the storage manager.
    try:
        manager = storage.GCSStorageManager(
            bucket=BUCKET_NAME,
            prefix=prefix,
            temp_dir=str(tmp_path),
        )
        blob = manager.bucket.blob(CHECK_ACCESS_KEY)
        assert blob.download_as_bytes() == CHECK_KEY_CONTENT
    except errors.NoDirectStorageAccess as e:
        # No access detected.
        if (not require_secrets) and isinstance(
            e.__cause__, google.auth.exceptions.DefaultCredentialsError
        ):
            pytest.skip("No GCS access")
        raise
    return manager