':type nestedList: List[NestedInteger]
:rtype: int'

def depthSum(self, nestedList):

    def depthSumHelper(nestedList, depth):
        res = 0
        for l in nestedList:
            if l.isInteger():
                res += (l.getInteger() * depth)
            else:
                res += depthSumHelper(l.getList(), (depth + 1))
        return res
    return depthSumHelper(nestedList, 1)
