<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pass_result(db: JobDB, always_cache=False):
 """Creates a pull stream receiving results, storing them in the database, then sending them on. At this stage, the database may return a list of attached jobs which also need to be sent on to the scheduler."""

    @pull
    def pass_result_stream(worker_source):
        """Pull stream instance created by `pass_result`."""
        for result in worker_source():
            if result is EndOfQueue:
                return

            attached = db.store_result_in_db(
                result, always_cache=always_cache)

            yield result
            yield from (ResultMessage(key, 'attached', result.value, None)
                        for key in attached)

    return pass_result_stream