code: def read_next_maf( file, species_to_lengths=None, parse_e_rows=False ):
      alignment = Alignment(species_to_lengths=species_to_lengths)
      line = readline( file, skip_blank=True )
      if not line: return None
      fields = line.split() 
      if fields[0] != 'a': raise Exception("Expected 'a ...' line")
      alignment.attributes = parse_attributes( fields[1:] )
      if 'score' in alignment.attributes:
          alignment.score = alignment.attributes['score']
          del alignment.attributes['score']
      else:
          alignment.score = 0
      last_component = None
      while 1:
          line = readline( file )
          if not line or line.isspace(): break
          if line.isspace(): break 
          fields = line.split()
          if fields[0] == 's':
              component = Component()
              component.src = fields[1]
              component.start = int( fields[2] )
              component.size = int( fields[3] )
              component.strand = fields[4]
              component.src_size = int( fields[5] )
              if len(fields) > 6: component.text = fields[6].strip()
              alignment.add_component( component )
              last_component = component
          elif fields[0] == 'e':
              if parse_e_rows:
                  component = Component()
                  component.empty = True
                  component.src = fields[1]
                  component.start = int( fields[2] )
                  component.size = int( fields[3] )
                  component.strand = fields[4]
                  component.src_size = int( fields[5] )
                  component.text = None
                  synteny = fields[6].strip()
                  assert len( synteny ) == 1, \
                      "Synteny status in 'e' rows should be denoted with a single character code"
                  component.synteny_empty = synteny
                  alignment.add_component( component )
                  last_component = component
          elif fields[0] == 'i':
              assert fields[1] == last_component.src, "'i' row does not follow matching 's' row"
              last_component.synteny_left = ( fields[2], int( fields[3] ) )
              last_component.synteny_right = ( fields[4], int( fields[5] ) )
          elif fields[0] == 'q':
              assert fields[1] == last_component.src, "'q' row does not follow matching 's' row"
              last_component.quality = fields[2]
      return alignment