code: def get_stream(self, name, force_refresh=False, serve_from_cache=False):
          uname, version = split_name(name)
          lock = None
          if self.local_store:
              lock = self.lock_manager.lock_for(uname)
              lock.lock_shared()
          try:
              if not self.remote_store or (version is not None
                                           and not force_refresh):
                  try:
                      if self.local_store and self.local_store.exists(name):
                          return self.local_store.get_stream(name)
                  except Exception:
                      if self.remote_store:
                          logger.warning("Error getting '%s' from local store",
                                         name, exc_info=True)
                      else:
                          raise
              if self.remote_store:
                  if self.local_store and serve_from_cache:
                      if version is None:
                          version = self.remote_store.file_version(name)
                          if version:
                              name = versioned_name(uname, version)
                      if force_refresh or not self.local_store.exists(name):
                          (stream, vname) = self.remote_store.get_stream(name)
                          name = self.local_store.add_stream(vname, stream)
                      return self.local_store.get_stream(name)
                  return self.remote_store.get_stream(name)
              raise FiletrackerError("File not available: %s" % name)
          finally:
              if lock:
                  lock.close()