original_docstring: 
      Two cases arise:
      1. Longest path considering current node.
      2. Longest path leaving current node aside.
      :returns:
          Max size taking cur node or a child as root,
          Max size taking it as part of another path
      
docstring: Two cases arise:
  1. Longest path considering current node.
  2. Longest path leaving current node aside.
docstring_tokens: Two cases arise : 1 . Longest path considering current node . 2 . Longest path leaving current node aside .
code: def _longest_path(cur_node: Node) -> [int, int]:
      """
      Two cases arise:
      1. Longest path considering current node.
      2. Longest path leaving current node aside.
      :returns:
          Max size taking cur node or a child as root,
          Max size taking it as part of another path
      """
      if not cur_node or not cur_node.children:
          return 0, 0
  
      children_paths = []
      max_as_path = 0
      max_as_path_2 = 0
  
      for (node, dist) in cur_node.children:
          as_root, as_node = _longest_path(node)
          children_paths.append(as_root)
  
          if as_node + dist > max_as_path:
              max_as_path, max_as_path_2 = as_node + dist, max_as_path
          elif as_node + dist > max_as_path_2:
              max_as_path_2 = as_node + dist
  
      return max(max(children_paths), max_as_path_2 + max_as_path), max_as_path
code_tokens: def _longest_path ( cur_node : Node ) -> [ int , int ] : if not cur_node or not cur_node . children : return 0 , 0 children_paths = [ ] max_as_path = 0 max_as_path_2 = 0 for ( node , dist ) in cur_node . children : as_root , as_node = _longest_path ( node ) children_paths . append ( as_root ) if as_node + dist > max_as_path : max_as_path , max_as_path_2 = as_node + dist , max_as_path elif as_node + dist > max_as_path_2 : max_as_path_2 = as_node + dist return max ( max ( children_paths ) , max_as_path_2 + max_as_path ) , max_as_path
short_docstring: Two cases arise:
  1.
short_docstring_tokens: Two cases arise : 1 .
comment: """
      Two cases arise:
      1. Longest path considering current node.
      2. Longest path leaving current node aside.
      :returns:
          Max size taking cur node or a child as root,
          Max size taking it as part of another path
      """