Nested Array Python Definition Function