check for index in list python