def rotate_inertia(rotation_matrix, inertia):
    """Returns an inertia tensor expressed in a reference frame which has
    been rotated with respect to the frame the inertia tensor is currently
    expressed in.

    Parameters
    ----------
    rotation_matrix : numpy.matrix, shape(3,3)
        Three-dimensional rotation/transformation/direction-cosine matrix
        that transforms a vector in the rotated reference frame into one in
        the current reference frame.
    inertia : numpy.matrix, shape(3,3)
        Three-dimensional cartesian tensor describing the inertia of a rigid
        body in a reference frame.

    Returns
    -------
    rotated_inertia : numpy.matrix, shape(3,3)
        The inertia tensor expressed in the rotated reference frame.

    Notes
    -----

    The provided inertia tensor is expressed in a reference frame, A, and
    there is a reference frame, B, which is rotated with respect to A such
    that a vector, v, expressed in B as v_b can be expressed in A as v_a by
    pre-multiplying by the rotation matrix, R:

    v_a = R * v_b

    Angular momentum of a rigid body expressed in A is defined as:

    H_a = I_a * w_a

    where H_a and w_a are the angular momentum and angular rate vectors,
    respectively and I_a is the inertia tensor, all expressed in A.
    Expressing H_a and w_a in B gives:

    R * H_b = I_a * R * w_b

    R * I_b * w_b = I_a * R * w_b

    So,

    R * I_b = I_a * R

    and thus:

    I_b = R^T * I_a * R

    """
    return rotation_matrix.T * inertia * rotation_matrix