python test if index in list