docs: def _sample(self, position, stepsize):
          """
          Returns a sample using a single iteration of NUTS
          """
  
          # Re-sampling momentum
          momentum = np.random.normal(0, 1, len(position))
  
          # Initializations
          depth = 0
          position_backward, position_forward = position, position
          momentum_backward, momentum_forward = momentum, momentum
          candidate_set_size = accept_set_bool = 1
          _, log_pdf = self.grad_log_pdf(position, self.model).get_gradient_log_pdf()
  
          # Resample slice variable `u`
          slice_var = np.random.uniform(0, np.exp(log_pdf - 0.5 * np.dot(momentum, momentum)))
  
          while accept_set_bool == 1:
              direction = np.random.choice([-1, 1], p=[0.5, 0.5])
              if direction == -1:
                  # Build a tree in backward direction
                  (position_backward, momentum_backward, _, _, position_bar,
                   candidate_set_size2, accept_set_bool2) = self._build_tree(position_backward, momentum_backward,
                                                                             slice_var, direction, depth, stepsize)
              else:
                  # Build tree in forward direction
                  (_, _, position_forward, momentum_forward, position_bar,
                   candidate_set_size2, accept_set_bool2) = self._build_tree(position_forward, momentum_forward,
                                                                             slice_var, direction, depth, stepsize)
              if accept_set_bool2 == 1:
                  if np.random.rand() < candidate_set_size2 / candidate_set_size:
                      position = position_bar.copy()
  
              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)
              depth += 1
  
          return position