1. def get_counts(data): """ Count how many times each item occurs in the sequence data """ counts = {} for d in data: if d in counts: counts[d] += 1 else: counts[d] = 1 return counts 2. def print_counts(counts): """ print out the counts from a dictionary, tab delimited """ for key in counts: print str(key) + "\t" + str(counts[key])