def flip_thetas(thetas, theta_pairs):
    """Flip thetas.

    Parameters
    ----------
    thetas : numpy.ndarray
        Joints in shape (num_thetas, 3)
    theta_pairs : list
        List of theta pairs.

    Returns
    -------
    numpy.ndarray
        Flipped thetas with shape (num_thetas, 3)

    """
    thetas_flip = thetas.copy()
    # reflect horizontally
    thetas_flip[:, 1] = -1 * thetas_flip[:, 1]
    thetas_flip[:, 2] = -1 * thetas_flip[:, 2]
    # change left-right parts
    for pair in theta_pairs:
        thetas_flip[pair[0], :], thetas_flip[pair[1], :] = \
            thetas_flip[pair[1], :], thetas_flip[pair[0], :].copy()

    return thetas_flip