old_contents: from collections import Counter
  from Bio import SeqIO
  from Bio.SeqUtils import GC
  for seq_record in SeqIO.parse("samples/test.fasta", "fasta"):
      print seq_record.id
      cnt = Counter()
      line = seq_record.seq
      n = 3
      for codon in [line[i:i+n] for i in range(0, len(line), n)]:
        cnt[str(codon)] += 1
      print cnt
  
  
  
new_contents: from collections import Counter
  from Bio import SeqIO
  from Bio.SeqUtils import GC
  for seq_record in SeqIO.parse("samples/test.fasta", "fasta"):
      print seq_record.id
      cnt = Counter()
      line = str(seq_record.seq)
      i = 0
      for j in range(((len(line))/ 3)):
        cnt[line[i:i+3]] += 1
        i += 3
      print cnt
  
  
subject: Improve performance. :)