Iterate Key Value Array Python Memory Allocation