def produce_vcftools_output(output, filename, append_mode=False,
    strip_header=False):
    """
        Creates the vcftools output file

        This function will create an output file from the vcftools stdout.
        Please run `check_vcftools_for_errors` prior to check that vcftools
        finished without error.

        Parameters
        ----------
        output : str
            vcftools stdout
        filename : str
            Specifies the filename for the output file
        append_mode : bool
            Used to create a single output file from multiple calls
        strip_header : bool
            Used to remove the header if not needed

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

    """
    if strip_header:
        output = ''.join(output.splitlines(True)[1:])
    if append_mode:
        vcftools_log_file = open(filename, 'a')
    else:
        vcftools_log_file = open(filename, 'w')
    vcftools_log_file.write(str(output))
    vcftools_log_file.close()
