def deaggregate_record(decoded_data):
is_aggregated = True<EOL>data_magic = None<EOL>if(len(decoded_data) >= len(aws_kinesis_agg.MAGIC)):<EOL><INDENT>data_magic = decoded_data[:len(aws_kinesis_agg.MAGIC)]<EOL><DEDENT>else:<EOL><INDENT>print("<STR_LIT>") <EOL>is_aggregated = False<EOL><DEDENT>decoded_data_no_magic = decoded_data[len(aws_kinesis_agg.MAGIC):]<EOL>if aws_kinesis_agg.MAGIC != data_magic or len(decoded_data_no_magic) <= aws_kinesis_agg.DIGEST_SIZE:<EOL><INDENT>is_aggregated = False<EOL><DEDENT>if is_aggregated:            <EOL><INDENT>message_digest = decoded_data_no_magic[-aws_kinesis_agg.DIGEST_SIZE:]<EOL>message_data = decoded_data_no_magic[:-aws_kinesis_agg.DIGEST_SIZE]<EOL>md5_calc = md5.new()<EOL>md5_calc.update(message_data)<EOL>calculated_digest = md5_calc.digest()<EOL>if message_digest != calculated_digest:            <EOL><INDENT>return [decoded_data]            <EOL><DEDENT>else:                            <EOL><INDENT>try:    <EOL><INDENT>ar = kpl_pb2.AggregatedRecord()<EOL>ar.ParseFromString(message_data)<EOL>return [mr.data for mr in ar.records]<EOL><DEDENT>except BaseException as e:<EOL><INDENT>raise e                   <EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>return [decoded_data]<EOL><DEDENT>
Given a Kinesis record data that is decoded, deaggregate if it was packed using the
    Kinesis Producer Library into individual records.  This method will be a no-op for any
    records that are not aggregated (but will still return them).

    decoded_data - the base64 decoded data that comprises either the KPL aggregated data, or the Kinesis payload directly.    
    return value - A list of deaggregated Kinesis record payloads (if the data is not aggregated, we just return a list with the payload alone)