<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sniff_csv_format(csv_file, potential_sep=['\t', ',', ';', '|', '-', '_'], max_test_lines=10, zip_file=None):
 """ Tries to get the separator, nr of index cols and header rows in a csv file Parameters csv_file: str Path to a csv file potential_sep: list, optional List of potential separators (delimiters) to test. Default: '\t', ',', ';', '|', '-', '_' max_test_lines: int, optional How many lines to test, default: 10 or available lines in csv_file zip_file: str, optional Path to a zip file containing the csv file (if any, default: None). If a zip file is given, the path given at 'csv_file' is assumed to be the path to the file within the zip_file. Returns ------- dict with sep: string (separator) nr_index_col: int nr_header_row: int Entries are set to None if inconsistent information in the file """


    def read_first_lines(filehandle):
        lines = []
        for i in range(max_test_lines):
            line = ff.readline()
            if line == '':
                break
            try:
                line = line.decode('utf-8')
            except AttributeError:
                pass
            lines.append(line[:-1])
        return lines

    if zip_file:
        with zipfile.ZipFile(zip_file, 'r') as zz:
            with zz.open(csv_file, 'r') as ff:
                test_lines = read_first_lines(ff)
    else:
        with open(csv_file, 'r') as ff:
            test_lines = read_first_lines(ff)

    sep_aly_lines = [sorted([(line.count(sep), sep)
                     for sep in potential_sep if line.count(sep) > 0],
                     key=lambda x: x[0], reverse=True) for line in test_lines]

    for nr, (count, sep) in enumerate(sep_aly_lines[0]):
        for line in sep_aly_lines:
            if line[nr][0] == count:
                break
        else:
            sep = None

        if sep:
            break

    nr_header_row = None
    nr_index_col = None

    if sep:
        nr_index_col = find_first_number(test_lines[-1].split(sep))
        if nr_index_col:
            for nr_header_row, line in enumerate(test_lines):
                if find_first_number(line.split(sep)) == nr_index_col:
                    break

    return dict(sep=sep,
                nr_header_row=nr_header_row,
                nr_index_col=nr_index_col)