code: def _apply_state_vector(
      state, num_wires
  ):  # function is easy to abstract for qudit
      """Initialize the internal state in a specified pure state.
  
      Args:
          state (array[complex]): normalized input state of length
              ``qudit_dim**num_wires``, where ``qudit_dim`` is the dimension of the system.
          num_wires (int): number of wires that get initialized in the state
  
      Returns:
          array[complex]: complex array of shape ``[qudit_dim] * (2 * num_wires)``
          representing the density matrix of this state, where ``qudit_dim`` is
          the dimension of the system.
      """
  
      # Initialize the entire set of wires with the state
      rho = qml.math.outer(state, qml.math.conj(state))
      return qml.math.reshape(rho, [qudit_dim] * 2 * num_wires)
  
imports: from typing import Iterable, Union
  import pennylane
  from pennylane.operation import StatePrepBase
label_desc: Use image node_id 2 for calling a global function with example usage: _apply_state_vector(state, num_wires) and returns: qml