def rotation_matrix(xangle, yangle, zangle, order='zxy', degrees=False):
    if degrees:
        xangle = math.radians(xangle)
        yangle = math.radians(yangle)
        zangle = math.radians(zangle)

    # Here we assume we rotate z, then x then y.
    c1 = math.cos(xangle) # The x angle
    c2 = math.cos(yangle) # The y angle
    c3 = math.cos(zangle) # the z angle
    s1 = math.sin(xangle)
    s2 = math.sin(yangle)
    s3 = math.sin(zangle)

    # see http://en.wikipedia.org/wiki/Rotation_matrix for
    # additional info.

    if order=='zxy':
        rot_mat = np.array([[c2*c3-s1*s2*s3, c2*s3+s1*s2*c3, -s2*c1],[-c1*s3, c1*c3, s1],[s2*c3+c2*s1*s3, s2*s3-c2*s1*c3, c2*c1]])
    else:
        rot_mat = np.eye(3)
        for i in range(len(order)):
            if order[i]=='x':
                rot_mat = np.dot(np.array([[1, 0, 0], [0,  c1, s1], [0, -s1, c1]]),rot_mat)
            elif order[i] == 'y':
                rot_mat = np.dot(np.array([[c2, 0, -s2], [0, 1, 0], [s2, 0, c2]]),rot_mat)
            elif order[i] == 'z':
                rot_mat = np.dot(np.array([[c3, s3, 0], [-s3, c3, 0], [0, 0, 1]]),rot_mat)

    return rot_mat


# Motion capture data routines.
Encode the given game instance as a JSON formatted string.  This string can be used to re-construct the game exactly
dataset/ETHPy150Open SheffieldML/GPy/GPy/util/mocap.py/rotation_matrix--crossover with--dataset/ETHPy150Open danielyule/hearthbreaker/hearthbreaker/serialization/serialization.py/serialize