def split_ranges(total, after=False, before=False):
    """
    Given a range 1, 2, ..., total (page numbers of a doc).
    Split it in two lists.
    Example:
    Input: total = 9, after=1, before=False
    Output: list1 = [1]; list2 = [2, 3, 4, ..., 9].

    Input: total = 9; after=False, before=1
    Output: list1 = [], list2 = [1, 2, 3, 4, ..., 9]

    Input: total = 5; after=4; before=False
    Output: list1 = [1, 2, 3, 4] list2 = [5]

    Input: total = 5; after=False; before=False;
    Output: list1 = [1, 2, 3, 4, 5], list2 = []
    (it means, by default, all pages are inserted at the end of the doc)
    """
    if after and not before:
        if not isinstance(after, int):
            raise ValueError(
                "argument 'after' is supposed to be an int"
            )
        list1 = list(range(1, after + 1))
        list2 = list(range(after + 1, total + 1))
        return list1, list2

    if not after and before:
        if not isinstance(before, int):
            raise ValueError(
                "argument 'before' is supposed to be an int"
            )
        list1 = list(range(1, before))
        list2 = list(range(before, total + 1))
        return list1, list2

    list1 = list(range(1, total + 1))
    list2 = []

    return list1, list2