code: def convert_labels_into_positions(pandas_index, labels):
      """
      Convert labels into positions
  
      :param pandas_index: pandas Index
      :param labels: labels
      :return: positions
      """
      result = []
      for label in labels:
          loc = pandas_index.get_loc(label)
          if isinstance(loc, (int, np.integer)):
              result.append(loc)
          else:
              # slice or boolean array
              result.extend(
                  pd.RangeIndex(len(pandas_index))[loc].tolist()
              )
      return np.asarray(result)
  
imports: import numpy
  import pandas
label_desc: Use image node_id 2 for calling a global function with example usage: convert_labels_into_positions(pandas_index, labels) and returns: np