def split_lambda(some_list, some_function, as_list=False):
    """ Splits a list into a dict such that all elements 'x' in 'some_list' that get one value from 'some_function(x)' 
        end up in the same list. 
        
        Example:
        split_lambda([1,2,3,4,5,6,7], lambda x: x%2) -> {0: [2, 4, 6], 1: [1, 3, 5, 7]}
        
        if as_list is True, then you would instead get [[2,4,6], [1,3,5,7]] in the above example (although order is not guaranteed)

    """
    
    lists = dict()
    for x in some_list:
        y = some_function(x)
        if y in lists:
            lists[y].append(x)
        else:
            lists[y] = [x]
    
    if as_list:
        return list(lists.values())
    else:    
        return lists