code: def _process_measurements(
      expanded_tape, device_wires, is_default_mixed
  ):
      measurements = expanded_tape.measurements.copy()
      if device_wires:
          for i, m in enumerate(measurements):
              if isinstance(m, qml.measurements.StateMP):
                  if is_default_mixed:
                      measurements[i] = qml.density_matrix(
                          wires=device_wires
                      )
              elif not m.wires:
                  measurements[i] = type(m)(wires=device_wires)
  
      return measurements
  
file_path: pennylane/pennylane/transforms/transpile.py
imports: from functools import partial
  from typing import List, Union, Sequence, Callable
  import networkx
  import pennylane
  from pennylane.transforms import transform
  from pennylane import Hamiltonian
  from pennylane.operation import Tensor
  from pennylane.ops import __all__
  from pennylane.ops.qubit import SWAP
  from pennylane.queuing import QueuingManager
  from pennylane.tape import QuantumTape
label_desc: Use image node_id 2 for calling a global function with example usage: _process_measurements(expanded_tape, device_wires, is_default_mixed) and returns: measurements