code: def _reshape_results(results: Sequence, shots: int) -> List[List]:
      """
      Helper function to reshape ``results`` into a two-dimensional nested list whose number of rows
      is determined by the number of shots and whose number of columns is determined by the number of
      cuts.
      """
      # each tape contains only expval measurements or sample measurements, so
      # stacking won't create any ragged arrays
      results = [
          qml.math.stack(tape_res)
          if isinstance(tape_res, tuple)
          else tape_res
          for tape_res in results
      ]
  
      results = [qml.math.flatten(r) for r in results]
      results = [
          results[i : i + shots] for i in range(0, len(results), shots)
      ]
      results = list(
          map(list, zip(*results))
      )  # calculate list-based transpose
  
      return results
  
file_path: pennylane/pennylane/qcut/processing.py
imports: import string
  from typing import List, Sequence
  from networkx import MultiDiGraph
  import pennylane
  from pennylane import numpy
  from .utils import MeasureNode, PrepareNode
label_desc: Use image node_id 4 for calling a global function with example usage: _reshape_results(results, shots) and returns: results