code snippet to quickly test if an API is cancellable