code: def get_bucketed_sizes(orig_sizes, buckets):
      sizes = np.copy(orig_sizes)
      assert np.min(sizes) >= 0
      start_val = -1
      for end_val in buckets:
          mask = (sizes > start_val) & (sizes <= end_val)
          sizes[mask] = end_val
          start_val = end_val
      return sizes
  
imports: import contextlib
  import itertools
  import logging
  import re
  import warnings
  from typing import Optional, Tuple
  import math
  import numpy
  import torch
  from fairseq.file_io import PathManager
  from fairseq import utils
  import os
label_desc: Use image node_id 18 for calling a global function with example usage: get_bucketed_sizes(orig_sizes, buckets) and returns: sizes