def _build_index(maf_strm, ref_spec):
  """Build an index for a MAF genome alig file and return StringIO of it."""
  idx_strm = StringIO.StringIO()
  bound_iter = functools.partial(genome_alignment_iterator,
                                 reference_species=ref_spec)
  hash_func = JustInTimeGenomeAlignmentBlock.build_hash
  idx = IndexedFile(maf_strm, bound_iter, hash_func)
  idx.write_index(idx_strm)
  idx_strm.seek(0)  # seek to the start
  return idx_strm
Build an index for a MAF genome alig file and return StringIO of it.