def detect_separator(file):
    """Detects csv separator"""
    file.seek(0)
    header = file.readline()
    possible_separators = [';', ',', '|', '\t']
    sep_count = dict()
    for sep in possible_separators:
        sep_count[sep] = header.count(sep)
    return max(sep_count, key=sep_count.get)
