def add_item(self, item, name, group_name=None, overwrite=False):
        """ Adds an existing item (Filter or FilterGroup).

        :param str name: Name of the new filter.
        :param item: The item to add.
        :type item: :class:`Filter` or :class:`FilterGroup`
        :param str group_name: Name of the group that the new filter belongs
            to. If this is None, the filter will not belong to any groop
            (root level) Default: None
        :param bool overwrite: If ``True``, an existing item with the same
            name will be overwritten. If ``False`` and an item with the
            same name exists, a value error is raised.
            Default: ``False``
        """
        if not group_name:
            if name in self.filters:
                if not overwrite:
                    raise ValueError('A filter or filter group named "%s" already exists!' % str(name))
                prev = self.filters[name]
                if isinstance(prev, FilterManager.FilterGroup) \
                        and isinstance(item, FilterManager.Filter):
                    raise ValueError('A filter group named "%s" already exists!' % str(name))
                if isinstance(prev, FilterManager.Filter) \
                        and isinstance(item, FilterManager.FilterGroup):
                    raise ValueError('A filter named "%s" already exists!' % str(name))

            self.filters[name] = item
        else:
            if not group_name in self.filters:
                raise ValueError('No filter group named "%s" exists!' % str(group_name))
            g = self.filters[group_name]
            if not overwrite and name in g.filters:
                raise ValueError('A filter named "%s" already exists in group "%s"!' % (str(name), str(group_name)))
            if g.exclusive and not self.currently_loading:
                if any(f.active for f in g.filters.itervalues()):
                    item.active = False
                elif all(not f.active for f in g.filters.itervalues()):
                    item.active = True
            g.filters[name] = item
dataset/ETHPy150Open rproepp/spykeviewer/spykeviewer/plugin_framework/filter_manager.py/FilterManager.add_item/original