docs: def avg_branch_length(self, terminal=True, internal=True):
          '''Compute the average length of the selected branches of this ``Tree``. Edges with length ``None`` will be treated as 0-length
  
          Args:
              ``terminal`` (``bool``): ``True`` to include terminal branches, otherwise ``False``
  
              ``internal`` (``bool``): ``True`` to include internal branches, otherwise ``False``
  
          Returns:
              The average length of the selected branches
          '''
          if not isinstance(terminal, bool):
              raise TypeError("terminal must be a bool")
          if not isinstance(internal, bool):
              raise TypeError("internal must be a bool")
          if not internal and not terminal:
              raise RuntimeError("Must select either internal or terminal branches (or both)")
          tot = 0.; num = 0
          for node in self.traverse_preorder():
              if node.edge_length is not None and (internal and not node.is_leaf()) or (terminal and node.is_leaf()):
                  tot += node.edge_length; num += 1
          return tot/num