@classmethod
    def from_v2(cls, block):
        indices = []
        for id, data in block.items():
            if "@case_type" not in data:
                raise CaseGenerationException("Invalid index, must have a case type attribute.")
            indices.append(CaseIndex(id, data["@case_type"], data.get("#text", ""),
                                     data.get("@relationship", 'child')))
        return cls(block, indices)
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/casexml/apps/case/xml/parser.py/CaseIndexAction.from_v2/original