code: def muscle_inputorder(inputfastafile, alnfile, trunc_name=True):
      
      sh("cp {0} {0}.old".format(alnfile), log=False)
      maxi = 30 if trunc_name else 1000
  
      aa = AlignIO.read(alnfile, "clustal")
      alignment = dict((a.id[:maxi], a) for a in aa)
      if trunc_name and len(alignment) < len(aa):
          raise ValueError\
              ("ERROR: The first 30 chars of your seq names are not unique")
  
      fw = must_open(alnfile, "w")
      for rec in SeqIO.parse(inputfastafile, "fasta"):
          a = alignment[rec.id[:maxi]]
          fw.write(">{0}\n{1}\n".format(a.id[:maxi], a.seq))
  
      fw.close()
      sh("rm {0}.old".format(alnfile), log=False)
docs: Fix for muscle -stable option according to here:
      http://drive5.com/muscle/stable.html