python get index in list if exists