import csv


def read_fragment_lengths(filename):
    """
    Given a name of a file with fragment lengths, read them to a
    dictionary.

    :param filename: a name of a file with fragment lengths
    :type filename: str
    :return: a dictionary which keys are fragment sequence names and
        values are their lengths
    :rtype: dict
    """
    result = dict()
    with open(filename) as length_file:
        length_reader = csv.reader(length_file, delimiter='\t')
        for fragment, length in length_reader:
            result[fragment] = int(length)
    return result