<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def scan(self, func=operator.add):
        '''
        An inclusive prefix sum which returns the cumulative application of the
        supplied function up to an including the current element.

        Args:
             func: An optional binary function which is commutative - that is,
                 the order of the arguments is unimportant.  Defaults to a
                 summing operator.

        Returns:
            A Queryable such that the nth element is the sum of the first n
            elements of the source sequence.

        Raises:
            ValueError: If the Queryable has been closed.
            TypeError: If func is not callable.
        '''
        if self.closed():
            raise ValueError("Attempt to call scan() on a "
                             "closed Queryable.")

        if not is_callable(func):
            raise TypeError("scan() parameter func={0} is "
                            "not callable".format(repr(func)))

        return self._create(self._generate_scan_result(func))