def METHOD_NAME(self, item, n):
    """get the nth child of an item"""
    if '__getitem__' in dir(item):
        #either list like or dict like
        if 'keys' in dir(item):
            #dict like
            return item.keys()[n]
        else:
            return '[%d]' %n
    else:
        return list(item.__dict__.keys())[n]