def print_output(self):
        if self.response_format == "csv":
            for key in self.measures:
                if "TIMING_" in key:
                    self.measures[key] = "NA"
        if not self.quiet:
            print
            print self.type.upper() + " RESULTS:"
            keys = [e for e in self.measures if 'COUNT_' in e]
            keys.sort()
            print "Counts:"
            print_table([(entry, str(self.measures[entry])) for entry in keys])
            keys = [e for e in self.measures if 'COLLECTION_' in e]
            keys.sort()
            print
            print "Collection measures:"
            print_table([(entry, str(self.measures[entry])) for entry in keys])
            if self.response_format == "TextGrid":
                keys = [e for e in self.measures if 'TIMING_' in e]
                keys.sort()
                print
                print "Time-based measures:"
                print_table([(entry, str(self.measures[entry])) for entry in keys])
        if self.target_file:
            with open(self.target_file, 'w') as outfile:
                header = ['file_id'] + \
                         [self.type + "_" + e for e in self.measures if 'COUNT_' in e] + \
                         [self.type + "_" + e for e in self.measures if 'COLLECTION_' in e] + \
                         [self.type + "_" + e for e in self.measures if 'TIMING_' in e]
                writer = csv.writer(outfile, quoting=csv.QUOTE_MINIMAL)
                writer.writerow(header)
                writer.writerow([self.measures["file_id"]] +
                                [self.measures["_".join(e.split('_')[1:])] for e in header[1:]])