def base0_interval_for_variant_fields(base1_location, ref, alt):
    """
    Inteval of interbase offsets of the affected reference positions for a
    particular variant's primary fields (pos, ref, alt).

    Parameters
    ----------
    base1_location : int
        First reference nucleotide of variant or, for insertions, the base
        before the insertion.

    ref : str
        Reference nucleotides

    alt : str
        Alternative nucleotides
    """
    if len(ref) == 0:
        # in interbase coordinates, the insertion happens
        # at the same start/end offsets, since those are already between
        # reference bases. Furthermore, since the convention for base-1
        # coordinates is to locate the insertion *after* the position,
        # in this case the interbase and base-1 positions coincide.
        base0_start = base1_location
        base0_end = base1_location
    else:
        # substitution or deletion
        base0_start = base1_location - 1
        base0_end = base0_start + len(ref)
    return base0_start, base0_end