def produce_vcftools_log(output, filename, append_mode=False):
    """
        Creates the vcftools log file

        This function will create a log file from the vcftools stderr. Please
        run `check_vcftools_for_errors` prior to check that vcftools finished
        without error.

        Parameters
        ----------
        output : str
            vcftools stderr
        filename : str
            Specifies the filename for the log file
        append_mode : bool
            Used to create a single log file from multiple calls

        Returns
        -------
        output : file
            vcftools log file

    """
    if append_mode:
        vcftools_log_file = open(filename + '.log', 'a')
    else:
        vcftools_log_file = open(filename + '.log', 'w')
    vcftools_log_file.write(str(output))
    vcftools_log_file.close()
