def METHOD_NAME(
    cmdline, pair, kbyte=None, force_type=None, dry_run=False, quiet=False, debug=False
):
    """Run an alignment. Returns a filehandle."""
    if not pair or len(pair) != 2:
        raise ValueError(f"Expected pair of filename, not {pair!r}")
    output_file = tempfile.NamedTemporaryFile(mode="r")
    input_files = (
        tempfile.NamedTemporaryFile(mode="w"),
        tempfile.NamedTemporaryFile(mode="w"),
    )
    if dry_run:
        print(
            _build_align_cmdline(
                cmdline, pair, output_file.name, kbyte, force_type, quiet
            )
        )
        return
    for filename, input_file in zip(pair, input_files):
        # Pipe the file through Biopython's Fasta parser/writer
        # to make sure it conforms to the Fasta standard (in particular,
        # Wise2 may choke on long lines in the Fasta file)
        records = SeqIO.parse(open(filename), "fasta")
        SeqIO.write(records, input_file, "fasta")
        input_file.flush()
    input_file_names = [input_file.name for input_file in input_files]
    cmdline_str = _build_align_cmdline(
        cmdline, input_file_names, output_file.name, kbyte, force_type, quiet
    )
    if debug:
        sys.stderr.write(f"{cmdline_str}\n")
    status = os.system(cmdline_str) >> 8
    # `status` here will be >1 for error codes >=256
    if status > 1:
        if kbyte != 0:  # possible memory problem; could be None
            sys.stderr.write("INFO trying again with the linear model\n")
            return METHOD_NAME(cmdline, pair, 0, force_type, dry_run, quiet, debug)
        else:
            raise OSError(f"{' '.join(cmdline)} returned {status}")
    return output_file