def _sorted_unique_insert(lst, val):
    """insert an element in a list and keep the list sorted.

    It is also ensured that no element appears in the list twice.
    Here are some examples:

    >>> l=[]
    >>> _sorted_unique_insert(l,4)
    >>> l
    [4]
    >>> _sorted_unique_insert(l,4)
    >>> l
    [4]
    >>> _sorted_unique_insert(l,6)
    >>> l
    [4, 6]
    >>> _sorted_unique_insert(l,6)
    >>> l
    [4, 6]
    >>> _sorted_unique_insert(l,4)
    >>> l
    [4, 6]
    >>> _sorted_unique_insert(l,5)
    >>> l
    [4, 5, 6]
    >>> _sorted_unique_insert(l,5)
    >>> l
    [4, 5, 6]
    >>> _sorted_unique_insert(l,4)
    >>> l
    [4, 5, 6]
    >>> _sorted_unique_insert(l,6)
    >>> l
    [4, 5, 6]
    >>> _sorted_unique_insert(l,2)
    >>> l
    [2, 4, 5, 6]
    >>> _sorted_unique_insert(l,3)
    >>> l
    [2, 3, 4, 5, 6]
    >>> _sorted_unique_insert(l,10)
    >>> l
    [2, 3, 4, 5, 6, 10]
    """
    if not lst:
        lst.append(val)
        return
    l = len(lst)
    for i in range(l):
        if val <= lst[i]:
            if val == lst[i]:
                return
            lst.insert(i, val)
            return
    lst.append(val)
