Converted https://github.com/timvideos/planet/commit/755a31783de6c4a54c9e070744853a52af66e4ea