    async def _get_or_create_user(self, username, hint):
        """Create user if username is found in config but user does not exist"""
        user = orm.User.find(self.db, name=username)
        if user is None:
            if not self.authenticator.validate_username(username):
                raise ValueError(f"Username {username!r} is not valid")
            self.log.info(f"Creating user {username} found in {hint}")
            user = orm.User(name=username)
            self.db.add(user)
            roles.assign_default_roles(self.db, entity=user)
            self.db.commit()
            f = self.authenticator.add_user(user)
            if f:
                await maybe_future(f)
        return user
Create user if username is found in config but user does not exist
jupyterhub/app.py