code: def scan_unique_upload_entries(upload_entries):
      """
      Returns upload entries for all files that could be found for given upload entries.
      In case of directory as upload entry, files we be taken from all subdirectories recursively.
      Any duplicated entries are removed.
      """
      walked_entries = set()
      for entry in upload_entries:
          if entry.is_stream() or not os.path.isdir(entry.source):
              walked_entries.add(entry)
          else:
              for root, _, files in os.walk(entry.source):
                  path_relative_to_entry_source = os.path.relpath(
                      root, entry.source
                  )
                  target_root = os.path.normpath(
                      os.path.join(
                          entry.target_path,
                          path_relative_to_entry_source,
                      )
                  )
                  for filename in files:
                      walked_entries.add(
                          UploadEntry(
                              os.path.join(root, filename),
                              os.path.join(target_root, filename),
                          )
                      )
  
      return walked_entries
  
imports: import io
  import logging
  import os
  import stat
  import time
  from abc import ABCMeta, abstractmethod
  from dataclasses import dataclass
  from io import BytesIO
  from pprint import pformat
  from typing import BinaryIO, Generator, List, Set, Union
  import six
label_desc: Use image node_id 1 for calling a global function with example usage: scan_unique_upload_entries(upload_entries) and returns: walked_entries