code: def split_upload_files(
      upload_entries: Set[UploadEntry],
      upload_configuration: AttributeUploadConfiguration,
      max_files=500,
  ) -> Generator[UploadPackage, None, None]:
      current_package = UploadPackage()
  
      for entry in upload_entries:
          if entry.is_stream():
              if current_package.len > 0:
                  yield current_package
                  current_package.reset()
              current_package.update(entry, 0)
              yield current_package
              current_package.reset()
          else:
              size = os.path.getsize(entry.source)
              if (
                  size + current_package.size
                  > upload_configuration.chunk_size
                  or current_package.len > max_files
              ) and not current_package.is_empty():
                  yield current_package
                  current_package.reset()
              current_package.update(entry, size)
  
      yield current_package
  
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 2 for calling a global function with example usage: split_upload_files(upload_entries, upload_configuration, max_files) without return types