<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_all_sequences_file(self, outname, outdir=None):
 """Write all the stored sequences as a single FASTA file. By default, sets IDs to model gene IDs. Args: outname (str):
 Name of the output FASTA file without the extension outdir (str):
 Path to output directory for the file, default is the sequences directory """


        if not outdir:
            outdir = self.sequence_dir
            if not outdir:
                raise ValueError('Output directory must be specified')

        outfile = op.join(outdir, outname + '.faa')
        SeqIO.write(self.sequences, outfile, "fasta")

        log.info('{}: wrote all protein sequences to file'.format(outfile))
        return outfile