old_contents: #!/usr/bin/env python
  #
  # -----------------------------------------------------------------------------
  # Copyright (c) 2016 The Regents of the University of California
  #
  # This file is part of kevlar (http://github.com/standage/kevlar) and is
  # licensed under the MIT license: see LICENSE.
  # -----------------------------------------------------------------------------
  
  from __future__ import print_function
  
  
  def parse(data):
      """
      Load sequences in Fasta format.
  
      This generator function yields a tuple containing a defline and a sequence
      for each record in the Fasta data. Stolen shamelessly from
      http://stackoverflow.com/a/7655072/459780.
      """
      name, seq = None, []
      for line in data:
          line = line.rstrip()
          if line.startswith('>'):
              if name:
                  yield (name, ''.join(seq))
              name, seq = line, []
          else:
              seq.append(line)
      if name:
          yield (name, ''.join(seq))
  
  
  def parse_seq_dict(data):
      """Load sequences from a Fasta file into a dictionary."""
      seqs = dict()
      for defline, sequence in parse(data):
          seqid = defline[1:].split(' ')[0]
          assert seqid not in seqs
          seqs[seqid] = sequence
      return seqs
  
new_contents: #!/usr/bin/env python
  #
  # -----------------------------------------------------------------------------
  # Copyright (c) 2016 The Regents of the University of California
  #
  # This file is part of kevlar (http://github.com/standage/kevlar) and is
  # licensed under the MIT license: see LICENSE.
  # -----------------------------------------------------------------------------
  
  from __future__ import print_function
  
  
  def parse(data):
      """
      Load sequences in Fasta format.
  
      This generator function yields a tuple containing a defline and a sequence
      for each record in the Fasta data. Stolen shamelessly from
      http://stackoverflow.com/a/7655072/459780.
      """
      name, seq = None, []
      for line in data:
          line = line.rstrip()
          if line.startswith('>'):
              if name:
                  yield (name, ''.join(seq))
              name, seq = line, []
          else:
              seq.append(line)
      if name:
          yield (name, ''.join(seq))
  
  
  def parse_seq_dict(data):
      """Load sequences from a Fasta file into a dictionary."""
      seqs = dict()
      for defline, sequence in parse(data):
          seqid = defline[1:].replace('\t', ' ').split(' ')[0]
          assert seqid not in seqs
          seqs[seqid] = sequence
      return seqs
  
subject: Fix the parse_seq_dict bug