python check if nth element in list exists