Typescript Group Array Of Structures In Python