docs: def _build_tree(self, position, momentum, slice_var, direction, depth, stepsize, position0, momentum0):
          """
          Recursively builds a tree for proposing new position and momentum
          """
          if depth == 0:
  
              position_bar, momentum_bar, candidate_set_size, accept_set_bool =\
                  self._initalize_tree(position, momentum, slice_var, direction * stepsize)
  
              alpha = min(1, self._acceptance_prob(position, position_bar, momentum, momentum_bar))
  
              return (position_bar, momentum_bar, position_bar, momentum_bar, position_bar,
                      candidate_set_size, accept_set_bool, alpha, 1)
  
          else:
              (position_backward, momentum_backward, position_forward, momentum_forward, position_bar,
               candidate_set_size, accept_set_bool, alpha, n_alpha) =\
                  self._build_tree(position, momentum, slice_var,
                                   direction, depth - 1, stepsize, position0, momentum0)
  
              if accept_set_bool == 1:
                  if direction == -1:
                      # Build tree in backward direction
                      (position_backward, momentum_backward, _, _, position_bar2, candidate_set_size2, accept_set_bool2,
                       alpha2, n_alpha2) = self._build_tree(position_backward, momentum_backward, slice_var, direction,
                                                            depth - 1, stepsize, position0, momentum0)
                  else:
                      # Build tree in forward direction
                      (_, _, position_forward, momentum_forward, position_bar2, candidate_set_size2, accept_set_bool2,
                       alpha2, n_alpha2) = self._build_tree(position_forward, momentum_forward, slice_var, direction,
                                                            depth - 1, stepsize, position0, momentum0)
  
                  if np.random.rand() < candidate_set_size2 / (candidate_set_size2 + candidate_set_size):
                      position_bar = position_bar2
  
                  alpha += alpha2
                  n_alpha += n_alpha2
                  accept_set_bool, candidate_set_size =\
                      self._update_acceptance_criteria(position_forward, position_backward, momentum_forward,
                                                       momentum_backward, accept_set_bool2, candidate_set_size,
                                                       candidate_set_size2)
  
              return (position_backward, momentum_backward, position_forward, momentum_forward, position_bar,
                      candidate_set_size, accept_set_bool, alpha, n_alpha)