def __init__(self,
            case_id,
            date_modified=None,
            user_id=undefined,
            owner_id=undefined,
            external_id=undefined,
            case_type=undefined,
            case_name=undefined,
            create=False,
            date_opened=undefined,
            update=None,
            close=False,
            index=None,
            strict=True,
        ):
        super(CaseBlock, self).__init__()
        self._id = case_id
        date_modified = date_modified or datetime.utcnow()
        update = copy.copy(update) if update else {}
        index = copy.copy(index) if index else {}

        self.XMLNS = NS_VERSION_MAP.get(V2)

        self.VERSION = V2
        self.CASE_TYPE = "case_type"

        if create:
            self['create'] = {}
            # make case_type
            case_type = "" if case_type is CaseBlock.undefined else case_type
            case_name = "" if case_name is CaseBlock.undefined else case_name
            owner_id = "" if owner_id is CaseBlock.undefined else owner_id
        self['update'] = update
        self['update'].update({
            'date_opened':                  date_opened
        })
        create_or_update = {
            self.CASE_TYPE:                 case_type,
            'case_name':                    case_name,
        }

        self.update({
            '_attrib': {
                'case_id':              case_id,
                'date_modified':        date_modified,
                'user_id':              user_id,
                'xmlns':                self.XMLNS,
            }
        })
        if owner_id is not None:
            create_or_update.update({
                'owner_id':                 owner_id,
            })
        self['update'].update({
            'external_id':              external_id,
        })

        # fail if user specifies both, say, case_name='Johnny' and update={'case_name': 'Johnny'}
        if strict:
            for key in create_or_update:
                if create_or_update[key] is not CaseBlock.undefined and key in self['update']:
                    raise CaseBlockError("Key %r specified twice" % key)

        if create:
            self['create'].update(create_or_update)
        else:
            self['update'].update(create_or_update)


        if close:
            self['close'] = {}

        if not ['' for val in self['update'].values() if val is not CaseBlock.undefined]:
                self['update'] = CaseBlock.undefined
        if index:
            self['index'] = {}
            for name in index.keys():
                case_type = index[name][0]
                case_id = index[name][1]
                # relationship = "child" for index to a parent case (default)
                # relationship = "extension" for index to a host case
                relationship = index[name][2] if len(index[name]) > 2 else 'child'
                if relationship not in ('child', 'extension'):
                    raise CaseBlockError('Valid values for an index relationship are "child" and "extension"')
                _attrib = {'case_type': case_type}
                if relationship != 'child':
                    _attrib['relationship'] = relationship
                self['index'][name] = {
                    '_attrib': _attrib,
                    '_text': case_id
                }
Returns the full path to dartjs.
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/casexml/apps/case/mock.py/CaseBlock.__init__--crossover with--dataset/ETHPy150Open guillermooo/dart-sublime-bundle/lib/sdk.py/SDK.path_to_dart2js