def combine_by_function(iterable, start_val, combine_func):
    """
    An approximation of the reduce method.
    :param iterable: input list etc.
    :param start_val: a starting value
    :param combine_func: a function taking two arguments and returning a value.
    :return: combined value
    """
    count = len(iterable)
    if count == 0:
        return start_val
    else:
        last_val = start_val
        index = 0
        while index < count:
            curr_elem = iterable[index]
            last_val = combine_func(last_val, curr_elem)
            index += 1
        return last_val