def sort_nested(lst, level=1):
    """
    Sort a list of lists up to the given level:

    0 = don't sort
    1 = sort outer list but keep inner lists untouched
    2 = sort inner lists first and then sort outer list
    """
    if level == 0:
        return lst
    elif level == 1:
        return sorted(lst)
    elif level == 2:
        return sorted(map(sorted, lst))
    else:
        raise ValueError("Sorting level must be <= 2")