def format_interval(value, year_tmpl='{: 05d}'):
    """

    >>> format_interval({'start_year': -9999,
    ...                  'start_month': 1,
    ...                  'start_day': 1,
    ...                  'end_year': 9999,
    ...                  'end_month': 12,
    ...                  'end_day': 31})
    '-9999-01-01/9999-12-31'

    >>> assert format_interval(None) is None
    """
    if value is None:
        return None

    year_values = [value.pop(key) for key in ('start_year', 'end_year')]
    # https://en.wikipedia.org/wiki/ISO_8601#Years
    for year in year_values:
        assert -9999 <= year <= 9999

    start_year, end_year = (year_tmpl.format(y).strip() for y in year_values)
    context = dict(value, start_year=start_year, end_year=end_year)

    return ('{start_year}-{start_month:02d}-{start_day:02d}'
            '/'
            '{end_year}-{end_month:02d}-{end_day:02d}').format_map(context)