def find_user(self, **kwargs):
        try:
            from mongoengine.queryset import Q, QCombination
        except __HOLE__:
            from mongoengine.queryset.visitor import Q, QCombination
        from mongoengine.errors import ValidationError

        queries = map(lambda i: Q(**{i[0]: i[1]}), kwargs.items())
        query = QCombination(QCombination.AND, queries)
        try:
            return self.user_model.objects(query).first()
        except ValidationError:  # pragma: no cover
            return None
dataset/ETHPy150Open mattupstate/flask-security/flask_security/datastore.py/MongoEngineUserDatastore.find_user