def _final_frame_length(header, final_frame_bytes):
    """Calculates the length of a final ciphertext frame, given a complete header
    and the number of bytes of ciphertext in the final frame.

    :param header: Complete message header object
    :type header: aws_encryption_sdk.structures.MessageHeader
    :param int final_frame_bytes: Bytes of ciphertext in the final frame
    :rtype: int
    """
    final_frame_length = 4  # Sequence Number End
    final_frame_length += 4  # Sequence Number
    final_frame_length += header.algorithm.iv_len  # IV
    final_frame_length += 4  # Encrypted Content Length
    final_frame_length += final_frame_bytes  # Encrypted Content
    final_frame_length += header.algorithm.auth_len  # Authentication Tag
    return final_frame_length
Calculates the length of a final ciphertext frame, given a complete header
    and the number of bytes of ciphertext in the final frame.

    :param header: Complete message header object
    :type header: aws_encryption_sdk.structures.MessageHeader
    :param int final_frame_bytes: Bytes of ciphertext in the final frame
    :rtype: int