'Transform ^(nil x) to x and nil to null'

def rulePostProcessing(self, root):

    if ((root is not None) and root.isNil()):
        if (root.getChildCount() == 0):
            root = None
        elif (root.getChildCount() == 1):
            root = root.getChild(0)
            root.setParent(None)
            root.setChildIndex((-1))
    return root
