def double_day(bday_1, bday_2, n=2):
    """Return the day when one person is twice as old as the other,
    given their birthdays. Optionally find when one person is n times older.
    bday_1, bday_2: date (or datetime) objects. Must be the same type.
    n: number, > 1
    """
    # Double day will be when the younger person's age is the
    # same as their difference in age.
    # The n-1 factor will just be 1 and have no effect if we're
    # doubling (n=2).
    # younger = older - diff. So if older = n * younger,
    # younger = n*younger - diff ==> younger = diff/(n-1).
    # So we just need the date when younger's age is diff/(n-1).
    diff = abs(bday_2 - bday_1)
    return max(bday_1, bday_2) + diff / (n-1)