def leap_years_before(y, calendar):
    """Return number of years before input year that are leap."""
    y -= 1
    if 'gregorian' == calendar:
        return y * 0.2425
    elif 'julian' == calendar:
        return y / 4
    elif 'leap' == calendar:
        return y
    else:
        return 0
