'Return True if if recognizes dialect and header.'

def sniff(self, filename):

    try:
        reader = csv.reader(open(filename, 'r'), self.dialect)
        header_row = next(reader)
        if (len(header_row) < 2):
            return False
        if self.strict_width:
            num_columns = len(header_row)
            found_second_line = False
            for data_row in reader:
                found_second_line = True
                if (num_columns != len(data_row)):
                    return False
            if (not found_second_line):
                return False
        else:
            data_row = next(reader)
            if (len(data_row) < 2):
                return False
            for data_row in reader:
                pass
        auto_dialect = csv.Sniffer().sniff(open(filename, 'r').read(self.big_peek_size))
        if (auto_dialect.delimiter != self.dialect.delimiter):
            return False
        if (auto_dialect.quotechar != self.dialect.quotechar):
            return False
        "\n                                                Not    checking    for    other    dialect    options\n                                                They    may    be    mis    detected    from    just    the    sample.\n                                                Or    not    effect    the    read    such    as    doublequote\n\n                                                Optional:    Check    for    headers    as    in    the    past.\n                                                Note    No    way    around    Python's    csv    calling    Sniffer.sniff    again.\n                                                Note    Without    checking    the    dialect    returned    by    sniff\n                                                                        this    test    may    be    checking    the    wrong    dialect.\n                                                "
        if (not csv.Sniffer().has_header(open(filename, 'r').read(self.big_peek_size))):
            return False
        return True
    except:
        return False
