Add a tag or populator to the batch by value and criteria

def add_upsert(self, value, criteria):
        """Add a tag or populator to the batch by value and criteria"""

        value = value.strip()
        v = value.lower()
        self.lower_val_to_val[v] = value
        criteria_array = self.upserts.get(v)
        if criteria_array is None:
            criteria_array = []
            # start with # '{"value": "some_value", "criteria": []}, '
            self.upserts_size[v] = 31 + len(value)
        criteria_array.append(criteria.to_dict())
        self.upserts[v] = criteria_array
        self.upserts_size[v] += criteria.json_size()