def create_user(self, request, username=None, password=None, email=None,
                    first_name=None, last_name=None, active=False,
                    superuser=False, odm_session=None, **kwargs):
        odm = request.app.odm()

        email = normalise_email(email)
        assert username or email
        if username:
            self.validate_username(request, username)

        with odm.begin(session=odm_session) as session:
            if not username:
                username = email

            if session.query(odm.user).filter_by(username=username).count():
                raise ValueError('Username not available')

            if (email and
                    session.query(odm.user).filter_by(email=email).count()):
                raise ValueError('Email not available')

            user = odm.user(username=username,
                            password=self.password(password),
                            email=email,
                            first_name=first_name,
                            last_name=last_name,
                            active=active,
                            superuser=superuser)
            session.add(user)

        return user
Create a new user.
dataset/ETHPy150Open quantmind/lux/lux/extensions/auth/backends.py/AuthMixin.create_user