code: def split_almost_equally(
      size: int, *, num_parts: int
  ) -> Iterable[slice]:
      """Split an interval of the given size into the given number of subintervals
  
      The sizes of the subintervals will at most the ceil of the exact fractional
      size, with later subintervals possibly being smaller (or even empty).
  
      """
      size_per_part = size // num_parts + (
          1 if size % num_parts != 0 else 0
      )
      for i in range(num_parts):
          yield slice(
              min(i * size_per_part, size),
              min((i + 1) * size_per_part, size),
          )
  
imports: import logging
  import multiprocessing
  import multiprocessing.pool
  import os
  import os.path
  import sys
  from collections import defaultdict
  from functools import partial
  from typing import Any, Callable, Dict, Iterable, List, Mapping, MutableMapping, Optional, Set, Tuple, TypeVar, Union
  import torch
  import torch.multiprocessing
  from torch.optim import Optimizer
  from torchbiggraph.config import ConfigSchema
  from torchbiggraph.types import Bucket, EntityName, FloatTensorType, Partition, Side
label_desc: Use image node_id 8 for calling a global function with example usage: split_almost_equally(size) without return types