import csv


def detect_delimiter(dsv_filename):
    """
    Detect and return delimiter used in dsv_filename

    Args:
        dsv_filename(str): path to the delimiter-separated value file whose
        delimiter is to be detected

    Returns:
        str: the detected delimiter
    """
    with open(dsv_filename) as dsv_file:
        dialect = csv.Sniffer().sniff(dsv_file.readline())
    return dialect.delimiter