def METHOD_NAME(network_pdu, iv_index, encryption_key, privacy_key):
    nonce = bytes(1) + network_pdu[1:7] + bytes(2) + iv_index
    if network_pdu[1] & 0x80:
        net_mic_len = 8
    else:
        net_mic_len = 4
    plaintext = network_pdu[7:]
    (ciphertext, net_mic) = aes_ccm_encrypt(encryption_key, nonce, plaintext, b'', net_mic_len)
    ciphertext_and_mic = ciphertext + net_mic
    privacy_random = ciphertext_and_mic[0:7]
    pecb = network_pecb(privacy_random, iv_index, privacy_key)
    obfuscated = bytes([(a ^ b) for (a,b) in zip(pecb, network_pdu[1:7])])  
    return network_pdu[0:1] + obfuscated + ciphertext_and_mic