def _add_item(self, dim_vals, data, sort=True, update=True):
        if not isinstance(dim_vals, tuple):
            dim_vals = (dim_vals,)

        self._item_check(dim_vals, data)

        # Apply dimension types
        dim_types = zip(self._cached_index_types, dim_vals)
        dim_vals = tuple(v if None in [t, v] else t(v) for t, v in dim_types)

        # Check and validate for categorical dimensions
        if self._cached_categorical:
            valid_vals = zip(self.kdims, dim_vals)
        else:
            valid_vals = []

        for dim, val in valid_vals:
            vals = self._cached_index_values[dim.name]
            if vals == 'initial': self._cached_index_values[dim.name] = []
            if not self._instantiated and self.get_dimension(dim).values == 'initial':
                if val not in vals:
                    self._cached_index_values[dim.name].append(val)
            elif vals and val not in vals:
                raise KeyError('%s dimension value %s not in'
                               ' specified dimension values.' % (dim, repr(val)))

        # Updates nested data structures rather than simply overriding them.
        if (update and (dim_vals in self.data)
            and isinstance(self.data[dim_vals], (MultiDimensionalMapping, OrderedDict))):
            self.data[dim_vals].update(data)
        else:
            self.data[dim_vals] = data

        if sort:
            self._resort()
If the token count passed to L{DeferredSemaphore} is less than one
dataset/ETHPy150Open ioam/holoviews/holoviews/core/ndmapping.py/MultiDimensionalMapping._add_item--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/test/test_defer.py/OtherPrimitives.test_semaphoreInvalidTokens