def to_hgvs(variants, reference=None, only_substitutions=True, sequence_prefix=False, sort=True):
    """An allele representation of a list of variants in HGVS [1]_.

    Parameters
    ----------
    variants : list
        A list of variants.
    reference : str or None, optional
        The reference sequence.

    Other Parameters
    ----------------
    only_substitutions : bool, optional
        Deleted symbols are filled in only for HGVS substitutions by default.
    sequence_prefix : bool, optional
        Prefix the allele description with the reference sequence
        (not RefSeq ID).
    sort : bool, optional
        The `variants` are sorted by default. Disable if already sorted.

    Returns
    -------
    str
        The allele representation in HGVS.

    References
    ----------
    [1] https://varnomen.hgvs.org/recommendations/DNA/variant/alleles/.
    """

    prefix = ""
    if reference is not None and sequence_prefix:
        prefix = f"{reference}:g."

    if len(variants) == 0:
        return f"{prefix}="

    if len(variants) == 1:
        return f"{prefix}{variants[0].to_hgvs(reference, only_substitutions)}"

    return f"{prefix}[{';'.join([variant.to_hgvs(reference, only_substitutions) for variant in (sorted(variants) if sort else variants)])}]"