code: def build_index(self, filename, indexfile):
          
          indexes = interval_index_file.Indexes()
          in_handle = open(filename)
  
          reader = maf.Reader(in_handle)
          while True:
              pos = reader.file.tell()
              rec = next(reader)
              if rec is None:
                  break
              for c in rec.components:
                  indexes.add(c.src, c.forward_strand_start,
                          c.forward_strand_end, pos, max=c.src_size )
  
          index_handle = open(indexfile, "w")
          indexes.write(index_handle)
          index_handle.close()
docs: Recipe from Brad Chapman's blog
          <http://bcbio.wordpress.com/2009/07/26/sorting-genomic-alignments-using-python/>