'Get User for username, creating if it doesn\'t exist'

def user_from_username(self, username):

    user = self.find_user(username)
    if (user is None):
        u = orm.User(name=username)
        self.db.add(u)
        self.db.commit()
        user = self._user_from_orm(u)
        self.authenticator.add_user(user)
    return user
