[python] How to check if array is not empty?