r"""
    Recursively removes Nones in all lists and sublists and replaces them with
    the repl variable

    Args:
        list_ (list):
        repl (obj): replacement value

    Returns:
        list

    CommandLine:
        python -m utool.util_list --test-replace_nones

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_list import *  # NOQA
        >>> # build test data
        >>> list_ = [None, 0, 1, 2]
        >>> repl = -1
        >>> # execute function
        >>> repl_list = replace_nones(list_, repl)
        >>> # verify results
        >>> result = str(repl_list)
        >>> print(result)
        [-1, 0, 1, 2]

def replace_nones(list_, repl=-1):
    r"""
    Recursively removes Nones in all lists and sublists and replaces them with
    the repl variable

    Args:
        list_ (list):
        repl (obj): replacement value

    Returns:
        list

    CommandLine:
        python -m utool.util_list --test-replace_nones

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_list import *  # NOQA
        >>> # build test data
        >>> list_ = [None, 0, 1, 2]
        >>> repl = -1
        >>> # execute function
        >>> repl_list = replace_nones(list_, repl)
        >>> # verify results
        >>> result = str(repl_list)
        >>> print(result)
        [-1, 0, 1, 2]

    """
    repl_list = [
        repl if item is None else (
            replace_nones(item, repl) if isinstance(item, list) else item
        )
        for item in list_
    ]
    return repl_list