Restructuring Array In Python Definition Function