def expand_page_break_before_after(tokens, name):
    """Expand legacy ``page-break-before`` and ``page-break-after`` properties.

    See https://www.w3.org/TR/css-break-3/#page-break-properties

    """
    keyword = get_single_keyword(tokens)
    new_name = name.split('-', 1)[1]
    if keyword in ('auto', 'left', 'right', 'avoid'):
        yield new_name, tokens
    elif keyword == 'always':
        token = IdentToken(
            tokens[0].source_line, tokens[0].source_column, 'page')
        yield new_name, [token]
    else:
        raise InvalidValues
Expand legacy ``page-break-before`` and ``page-break-after`` properties.

See https://www.w3.org/TR/css-break-3/#page-break-properties
weasyprint/css/validation/expanders.py