code: def rotate_quat(attitude, roll, pitch, yaw):
    '''
    Returns rotated quaternion
    :param attitude: quaternion [w, x, y , z]
    :param roll: rotation in rad
    :param pitch: rotation in rad
    :param yaw: rotation in rad
    :returns: quaternion [w, x, y , z]
    '''
    quat = Quaternion(attitude)
    rotation = Quaternion([roll, pitch, yaw])
    res = rotation * quat
  
    return res.f rotate_quat(attitude, roll, pitch, yaw):
    '''
    Returns rotated quaternion
    :param attitude: quaternion [w, x, y , z]
    :param roll: rotation in rad
    :param pitch: rotation in rad
    :param yaw: rotation in rad
    :returns: quaternion [w, x, y , z]
    '''
    quat = Quaternion(attitude)
    rotation = Quaternion([roll, pitch, yaw])
    res = rotation * quat
  
    return res.q
docs: Returns rotated quaternion
    :param attitude: quaternion [w, x, y , z]
    :param roll: rotation in rad
    :param pitch: rotation in rad
    :param yaw: rotation in rad
    :returns: quaternion [w, x, y , z]