[python] Using a dictionary to count the items in a list