code: def _accumulate_remotes(synapse_parent_id, syn):
      
      remotes = {}
      s_base_folder = syn.get(synapse_parent_id)
      for (s_dirpath, s_dirpath_id), _, s_filenames in synapseutils.walk(syn, synapse_parent_id):
          remotes[s_dirpath] = s_dirpath_id
          if s_filenames:
              for s_filename, s_filename_id in s_filenames:
                  remotes[os.path.join(s_dirpath, s_filename)] = s_filename_id
      return s_base_folder, remotes
docs: Retrieve references to all remote directories and files.