code: def quaternion_from_euler(ai, aj, ak, axes="sxyz"):
      """Return quaternion from Euler angles and axis sequence.
  
      ai, aj, ak : Euler's roll, pitch and yaw angles
      axes : One of 24 axis sequences as string or encoded tuple
  
      >>> q = quaternion_from_euler(1, 2, 3, 'ryxz')
      >>> numpy.allclose(q, [0.435953, 0.310622, -0.718287, 0.444435])
      True
  
      """
      try:
          firstaxis, parity, repetition, frame = _AXES2TUPLE[
              axes.lower()
          ]
      except (AttributeError, KeyError):
          _TUPLE2AXES[axes]  # noqa: validation
          firstaxis, parity, repetition, frame = axes
  
      i = firstaxis + 1
      j = _NEXT_AXIS[i + parity - 1] + 1
      k = _NEXT_AXIS[i - parity] + 1
  
      if frame:
          ai, ak = ak, ai
      if parity:
          aj = -aj
  
      ai /= 2.0
      aj /= 2.0
      ak /= 2.0
      ci = math.cos(ai)
      si = math.sin(ai)
      cj = math.cos(aj)
      sj = math.sin(aj)
      ck = math.cos(ak)
      sk = math.sin(ak)
      cc = ci * ck
      cs = ci * sk
      sc = si * ck
      ss = si * sk
  
      q = numpy.empty((4,))
      if repetition:
          q[0] = cj * (cc - ss)
          q[i] = cj * (cs + sc)
          q[j] = sj * (cc + ss)
          q[k] = sj * (cs - sc)
      else:
          q[0] = cj * cc + sj * ss
          q[i] = cj * sc - sj * cs
          q[j] = cj * ss + sj * cc
          q[k] = cj * cs - sj * sc
      if parity:
          q[j] *= -1.0
  
      return q
  
imports: import math
  import numpy
label_desc: Use image node_id 23 for calling a global function with example usage: quaternion_from_euler(ai, aj, ak, axes) and returns: q