def slim_frame_data(frames, frame_allowance=25):
    """
    Removes various excess metadata from middle frames which go beyond
    ``frame_allowance``.

    Returns ``frames``.
    """
    frames_len = len(frames)

    if frames_len <= frame_allowance:
        return frames

    half_max = int(frame_allowance / 2)

    for n in range(half_max, frames_len - half_max):
        # remove heavy components
        frames[n].pop('vars', None)
        frames[n].pop('pre_context', None)
        frames[n].pop('post_context', None)
    return frames