python check if index in list