def METHOD_NAME(self, item):
    nchild = item.childCount()
    if item.type is dict:
        document = {}
        for i in range(nchild):
            ch = item.child(i)
            document[ch.key] = self.METHOD_NAME(ch)
        return document
    elif item.type == list:
        document = []
        for i in range(nchild):
            ch = item.child(i)
            document.append(self.METHOD_NAME(ch))
        return document
    else:
        return item.value