docs: def from_forums(cls, forums):
          """ Initializes a ``ForumVisibilityContentTree`` instance from a list of forums. """
          root_level = None
          current_path = []
          nodes = []
  
          # Ensures forums last posts and related poster relations are "followed" for better
          # performance (only if we're considering a queryset).
          forums = (
              forums.select_related('last_post', 'last_post__poster')
              if isinstance(forums, QuerySet) else forums
          )
  
          for forum in forums:
              level = forum.level
  
              # Set the root level to the top node level at the first iteration.
              if root_level is None:
                  root_level = level
  
              # Initializes a visibility forum node associated with current forum instance.
              vcontent_node = ForumVisibilityContentNode(forum)
  
              # Computes a relative level associated to the node.
              relative_level = level - root_level
              vcontent_node.relative_level = relative_level
  
              # All children nodes will be stored in an array attached to the current node.
              vcontent_node.children = []
  
              # Removes the forum that are not in the current branch.
              while len(current_path) > relative_level:
                  current_path.pop(-1)
  
              if level != root_level:
                  # Update the parent of the current forum.
                  parent_node = current_path[-1]
                  vcontent_node.parent = parent_node
                  parent_node.children.append(vcontent_node)
  
              # Sets visible flag if applicable. The visible flag is used to determine whether a forum
              # can be seen in a forum list or not. A forum can be seen if one of the following
              # statements is true:
              #
              # * the forum is a direct child of the starting forum for the considered level
              # * the forum have a parent which is a category and this category is a direct child of
              #   the starting forum
              # * the forum have its 'display_sub_forum_list' option set to True and have a parent
              #   which is another forum. The latter is a direct child of the starting forum
              # * the forum have its 'display_sub_forum_list' option set to True and have a parent
              #   which is another forum. The later have a parent which is a category and this
              #   category is a direct child of the starting forum
              #
              # If forums at the root level don't have parents, the visible forums are those that can
              # be seen from the root of the forums tree.
              vcontent_node.visible = (
                  (relative_level == 0) or
                  (forum.display_sub_forum_list and relative_level == 1) or
                  (forum.is_category and relative_level == 1) or
                  (
                      relative_level == 2 and
                      vcontent_node.parent.parent.obj.is_category and
                      vcontent_node.parent.obj.is_forum
                  )
              )
  
              # Add the current forum to the end of the current branch and inserts the node inside the
              # final node dictionary.
              current_path.append(vcontent_node)
              nodes.append(vcontent_node)
  
          tree = cls(nodes=nodes)
          for node in tree.nodes:
              node.tree = tree
  
          return tree