code: def _get_split_size(
      total_size: int,
      minimum_split_size: int = 1024 * 1000 * 20,
      max_split_count: int = MAX_SPLIT_COUNT,
  ) -> int:
      """Calculate the split size we should use to split the multipart upload of an object to a bucket.  We are limited
      to 1000 max parts as the way we are using ListMultipartUploads. More info https://github.com/gridai/grid/pull/5267
      https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html#mpu-process
      https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html
      https://github.com/psf/requests/issues/2717#issuecomment-724725392 Python or requests has a limit of 2**31 bytes
      for a single file upload.
  
      Parameters
      ----------
      minimum_split_size: int
          The minimum split size to use
      max_split_count: int
          The maximum split count
      total_size: int
          Total size of the file to split
  
      Returns
      -------
      int
          Split size
  
      """
      max_size = max_split_count * (
          1 << 31
      )  # max size per part limited by Requests or urllib as shown in ref above
      if total_size > max_size:
          raise click.ClickException(
              f"The size of the datastore to be uploaded is bigger than our {max_size / (1 << 40):.2f} TBytes limit"
          )
  
      split_size = minimum_split_size
      split_count = math.ceil(total_size / split_size)
      if split_count > max_split_count:
          # Adjust the split size based on max split count
          split_size = math.ceil(total_size / max_split_count)
  
      return split_size
  
file_path: pytorch-lightning/src/lightning/app/source_code/tar.py
imports: import math
  import os
  import subprocess
  import tarfile
  from dataclasses import dataclass
  from typing import Optional, Tuple
  import click
label_desc: Use image node_id 2 for calling a global function with example usage: _get_split_size(total_size, minimum_split_size, max_split_count) and returns: split_size