@utils.immutable
    def filter(self, value=None, exclude=False, **selection):
        filters = self.meta.setdefault('filters', [])

        if value and len(selection):
            raise ValueError("Cannot specify a filter string and a filter keyword selection at the same time.")
        elif value:
            value = [value]
        elif len(selection):
            value = select(self.api.columns, selection, invert=exclude)

        filters.append(value)
        self.raw['filters'] = utils.paste(filters, ',', ';')
        return self
Most of the actual functionality lives on the Column
dataset/ETHPy150Open debrouwere/google-analytics/googleanalytics/query.py/Query.filter