<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def mafft(sequences=None, alignment_file=None, fasta=None, fmt='fasta', threads=-1, as_file=False,
          reorder=True, print_stdout=False, print_stderr=False, mafft_bin=None):
    '''
    Performs multiple sequence alignment with MAFFT.

    Args:

        sequences (list): Sequences to be aligned. ``sequences`` can be one of four things:

            1. a FASTA-formatted string

            2. a list of BioPython ``SeqRecord`` objects

            3. a list of AbTools ``Sequence`` objects

            4. a list of lists/tuples, of the format ``[sequence_id, sequence]``

        alignment_file (str): Path for the output alignment file. If not supplied,
            a name will be generated using ``tempfile.NamedTemporaryFile()``.

        fasta (str): Path to a FASTA-formatted file of sequences. Used as an
            alternative to ``sequences`` when suppling a FASTA file.

        fmt (str): Format of the alignment. Options are 'fasta', 'phylip', and 'clustal'. Default
            is 'fasta'.

        threads (int): Number of threads for MAFFT to use. Default is ``-1``, which
            results in MAFFT using ``multiprocessing.cpu_count()`` threads.

        as_file (bool): If ``True``, returns a path to the alignment file. If ``False``,
            returns a BioPython ``MultipleSeqAlignment`` object (obtained by calling
            ``Bio.AlignIO.read()`` on the alignment file).
        
        print_stdout (bool): If ``True``, prints MAFFT's standard output. Default is ``False``.

        print_stderr (bool): If ``True``, prints MAFFT's standard error. Default is ``False``.

        mafft_bin (str): Path to MAFFT executable. ``abutils`` includes built-in MAFFT binaries
            for MacOS and Linux, however, if a different MAFFT binary can be provided. Default is
            ``None``, which results in using the appropriate built-in MAFFT binary.

    Returns:

        Returns a BioPython ``MultipleSeqAlignment`` object, unless ``as_file`` is ``True``,
            in which case the path to the alignment file is returned.

    '''
    if sequences:
        fasta_string = _get_fasta_string(sequences)
        fasta_file = tempfile.NamedTemporaryFile(delete=False)
        fasta_file.close()
        ffile = fasta_file.name
        with open(ffile, 'w') as f:
            f.write(fasta_string)
    elif fasta:
        ffile = fasta
    if alignment_file is None:
        alignment_file = tempfile.NamedTemporaryFile(delete=False).name
    aln_format = ''
    if fmt.lower() == 'clustal':
        aln_format = '--clustalout '
    if fmt.lower() == 'phylip':
        aln_format = '--phylipout '
    if reorder:
        aln_format += '--reorder '
    if mafft_bin is None:
        mafft_bin = 'mafft'
        # mod_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
        # mafft_bin = os.path.join(BINARY_DIR, 'mafft_{}'.format(platform.system().lower()))
    mafft_cline = '{} --thread {} {}{} > {}'.format(mafft_bin, threads, aln_format, ffile, alignment_file)
    mafft = sp.Popen(str(mafft_cline),
                     stdout=sp.PIPE,
                     stderr=sp.PIPE,
                     universal_newlines=True,
                     shell=True)
    stdout, stderr = mafft.communicate()
    if print_stdout:
        print(mafft_cline)
        print(stdout)
    if print_stderr:
        print(stderr)
    os.unlink(ffile)
    if os.stat(alignment_file).st_size == 0:
        return None
    if as_file:
        return alignment_file
    aln = AlignIO.read(open(alignment_file), fmt)
    os.unlink(alignment_file)
    return aln