<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read_source_alleles(file_name):
 """Reads an allele file."""

    alleles = {}
    open_function = open
    if file_name.endswith(".gz"):
        open_function = gzip.open
    with open_function(file_name, 'rb') as input_file:
        for line in input_file:
            row = line.rstrip("\r\n").split("\t")
            marker_name = row[0]
            allele1, allele2 = row[1].split(" ")
            alleles[marker_name] = {allele1, allele2}

    return alleles