<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def snapshot(self, scheduler=None):
 """ Returns a Snapshot containing the sources, relative to the build root. This API is experimental, and subject to change. """

    if isinstance(self._sources, EagerFilesetWithSpec):
      snapshot = self._sources.snapshot
      if snapshot is not None:
        return snapshot
    input_pathglobs = PathGlobs(tuple(self.relative_to_buildroot()))
    return scheduler.product_request(Snapshot, [input_pathglobs])[0]