Important: This is a Public Preview API. It may be changed or removed at any time.
Implementation based on https://gist.github.com/VincentMasselis/9912b4be4d952eaa9265