Check MIC, ICV & return the data from a decrypted TKIP packet

def check_MIC_ICV(data, mic_key, source, dest):
    """Check MIC, ICV & return the data from a decrypted TKIP packet"""
    assert len(data) > 12

    # DATA - MIC(DA - SA - Priority=0 - 0 - 0 - 0 - DATA) - ICV
    # 802.11i p.47

    ICV = data[-4:]
    MIC = data[-12:-4]
    data_clear = data[:-12]

    expected_ICV = pack("<I", crc32(data_clear + MIC) & 0xFFFFFFFF)
    if expected_ICV != ICV:
        raise ICVError()

    sa = mac2str(source)  # Source MAC
    da = mac2str(dest)  # Dest MAC

    expected_MIC = michael(mic_key, da + sa + b"\x00" * 4 + data_clear)
    if expected_MIC != MIC:
        raise MICError()

    return data_clear