code: def writefasta(self, fname):
          
          f = open(fname, "w")
          fa_str = "\n".join([">%s\n%s" % (id, self._format_seq(seq)) for id, seq in self.items()])
          f.write(fa_str)
          f.close()
docs: Write sequences to FASTA formatted file