def contains(self, obj):

        if self.scalar and not self._value_is_scalar:
            return self._comparator.has(
                getattr(self.target_class, self.value_attr).contains(obj)
            )
        else:
            return self._comparator.any(**{self.value_attr: obj})
Produce a proxied 'contains' expression using EXISTS.
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/ext/associationproxy.py/AssociationProxy.contains