Js Subarray From Array To Hashmap In Python