'Try to guess the Arff filetype.
It usually starts with a "format-version:" string and has several stanzas which starts with "id:".'

def sniff(self, filename):

    with open(filename) as handle:
        relation_found = False
        attribute_found = False
        for (line_count, line) in enumerate(handle):
            if (line_count > 1000):
                return False
            line = line.strip()
            if (not line):
                continue
            start_string = line[:20].upper()
            if start_string.startswith('@RELATION'):
                relation_found = True
            elif start_string.startswith('@ATTRIBUTE'):
                attribute_found = True
            elif start_string.startswith('@DATA'):
                if (relation_found and attribute_found):
                    return True
    return False
