Python Array Extend Function Python Code