code: def _compute_grouping_indices(
      observables, grouping_type="qwc", method="rlf"
  ):
      # todo: directly compute the
      # indices, instead of extracting groups of observables first
      observable_groups = qml.pauli.group_observables(
          observables,
          coefficients=None,
          grouping_type=grouping_type,
          method=method,
      )
  
      observables = copy(observables)
  
      indices = []
      available_indices = list(range(len(observables)))
      for (
          partition
      ) in observable_groups:  # pylint:disable=too-many-nested-blocks
          indices_this_group = []
          for pauli_word in partition:
              # find index of this pauli word in remaining original observables,
              for observable in observables:
                  if qml.pauli.are_identical_pauli_words(
                      pauli_word, observable
                  ):
                      for ind, obs in enumerate(observables):
                          if obs is not observable:
                              continue
                          indices_this_group.append(
                              available_indices[ind]
                          )
                          # delete this observable and its index, so it cannot be found again
                          observables.pop(ind)
                          available_indices.pop(ind)
                          break
                      break
          indices.append(tuple(indices_this_group))
  
      return tuple(indices)
  
imports: import itertools
  import numbers
  from collections.abc import Iterable
  from copy import copy
  import functools
  from typing import List
  import numpy
  import scipy
  import pennylane
  from pennylane.operation import Observable, Tensor
  from pennylane.wires import Wires
label_desc: Use image node_id 1 for calling a global function with example usage: _compute_grouping_indices(observables, grouping_type, method) and returns: tuple