code: def _quaternion_transform(matrix):
      r"""Perform a SU(2) to quaternion transformation.
  
      Any element :math:`\text{SU}_2(\mathbb{C})` can be be written as a unique quaternion
      :math:`\alpha_0\mathbb{I} + \alpha_1\mathbf{i} + \alpha_2\mathbf{j} + \alpha_3\mathbf{k}`,
      where :math:`\mathbf{i}=-i\mathbf{X},\ \mathbf{j}=-i\mathbf{Y},\ \text{and}\ \mathbf{k}=-i\mathbf{Z}`.
      """
      return qml.math.array(
          [
              qml.math.real(matrix[0, 0]),
              -qml.math.imag(matrix[0, 1]),
              -qml.math.real(matrix[0, 1]),
              -qml.math.imag(matrix[0, 0]),
          ],
          dtype=float,
      )
  
file_path: pennylane/pennylane/ops/op_math/decompositions/solovay_kitaev.py
imports: import math
  import warnings
  from functools import lru_cache
  from scipy.spatial import KDTree
  import pennylane
  from pennylane.queuing import QueuingManager
  from pennylane.tape import QuantumScript
label_desc: Use image node_id 2 for calling a global function with example usage: _quaternion_transform(matrix) and returns: qml