code: def username_is_available(self, new_username):
          
  
          # Return True if new_username equals current user's username
          if self.user_manager.call_or_get(current_user.is_authenticated):
              if new_username == current_user.username:
                  return True
  
          # Return True if new_username does not exist,
          # Return False otherwise.
          return self.find_user_by_username(new_username) == None
docs: Check if ``new_username`` is still available.
  
          | Returns True if ``new_username`` does not exist or belongs to the current user.
          | Return False otherwise.