def update_te_inst(self, instance_data):
        """
        Update a tracked entity instance with the given data

        :param instance_data: Tracked entity instance data. Must include its ID,
                     organisation unit and tracked entity type
        """
        try:
            te_inst_id = instance_data.pop('Instance')
            ou_id = instance_data.pop('Org unit')
        except KeyError as err:
            raise KeyError(err % 'Mandatory attribute missing from tracked entity instance data: %s')
        request_data = {
            'trackedEntityInstance': te_inst_id,
            'orgUnit': ou_id,
            'attributes': self._data_to_attributes(instance_data)
        }
        response = self._request.put('trackedEntityInstances/' + te_inst_id, request_data)
        if response['status'] != 'SUCCESS':
            logger.error('Failed to update instance of tracked entity "%s". DHIS2 API error: %s',
                         te_inst_id, response)
dataset/ETHPy150Open dimagi/commcare-hq/custom/dhis2/models.py/Dhis2Api.update_te_inst/swapped operands of `%`