def __rmul__(self, other):
    """ Scalar quaternion multiplication.

    The multiplication with a scalar returns the quaternion with all elements
    multiplied by the scalar.
    """
    if isinstance(other, Number):
      q = self.q.copy()
      q_out = np.float64(other) * q
      return Quaternion(q=q_out)
    else:
      assert False, "Multiplication is only defined for scalars or quaternions."
 Scalar quaternion multiplication.

    The multiplication with a scalar returns the quaternion with all elements
    multiplied by the scalar.
    
hand_eye_calibration/python/hand_eye_calibration/quaternion.py