I recently came across a case where the format sniffer in Python's csv module was not satisfactory. The problem is that the format sniffer always identifies a quote character, even when there is no quote character in the CSV file (e.g., in the case of a tab-delimited file). By default the format sniffer reports that a double-quote character is used. This is not a problem if you subsequently use the csv module itself to read the file. However, I wanted to use the csv module only if the file contained quote characters, and use a different method (the copy_from method of the psycopg module) if the file contained no quote characters. I could not make this distinction using the csv module's format sniffer, so I wrote the following one to use instead.