verifies if `root` is dict before doing `.get` (#4668)
verifies if `root` is dict before doing `.get` (#4668)

* verifies if root is dict before doing .get

* adds reason for change in comments

Co-Authored-By: Julia <cf69f0cb0ea9c70f0cfdc9d50172f15872410d78@users.noreply.github.com>

* style fix

DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core