def format_alleles(genotype, alleles, defaults=None):
    """
    Formats the alleles from a genotype record.
    """
    al1, al2 = "", ""
    if defaults:
        al1 = defaults[0]
        al2 = defaults[1]

    if "GT" in genotype and genotype["GT"]:
        als = genotype["GT"]
        if len(als) == 1:
            als = sorted(list(als) + [0])
        al1 = alleles[als[0]]
        al2 = alleles[als[1]]
    return [al1, al2]