'Generate a dict mapping each response/comment in the thread
by its `id`.'

def _get_comment_map(self):

    def _visit(obj):
        res = []
        for child in obj.get('children', []):
            res.append((child['id'], child))
            if ('children' in child):
                res += _visit(child)
        return res
    return dict(_visit(self.thread))
