python check if value in list and get index