import csv


def _csv_sniff(f):
    """
    Sniff using csv module whether or not a csv file (csv or gz) has a header.

    Arguments:
        f (filehandle) :
            filehandle of the file to be read
    """
    sniff_size = 2**20 - 1
    dialect = csv.Sniffer().sniff(f.read(sniff_size))
    f.seek(0)
    has_header = csv.Sniffer().has_header(f.read(sniff_size))
    f.seek(0)
    return dialect, has_header