docs: def add_user(user, **kwargs):
      """
          Add a user
      """
      #check_perm(kwargs.get('user_id'), 'add_user')
      u = User()
  
      u.username     = user.username
      u.display_name = user.display_name
  
      user_id = _get_user_id(u.username)
  
      #If the user is already there, cannot add another with
      #the same username.
      if user_id is not None:
          raise HydraError("User %s already exists!"%user.username)
  
      u.password = bcrypt.hashpw(str(user.password).encode('utf-8'), bcrypt.gensalt())
  
      db.DBSession.add(u)
      db.DBSession.flush()
  
      return u