code: def _pad_packed_sequence(data, batch_sizes):
      padded_data = ivy.full(
          (len(batch_sizes), int(max(batch_sizes)), *data.shape[1:]),
          0,
          dtype=data.dtype,
          device=data.device,
      )
      data_offset = 0
      for i, batch_size in enumerate(batch_sizes):
          batch_size = int(batch_size)
          padded_data[i, :batch_size] = data[
              data_offset : data_offset + batch_size
          ]
          data_offset += batch_size
      lengths = ivy.sum(
          ivy.arange(1, int(max(batch_sizes)) + 1)[:, ivy.newaxis]
          <= batch_sizes,
          axis=1,
          dtype=ivy.int64,
      )
      return padded_data, lengths
  
imports: from typing import Optional, Tuple, Union, Sequence
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, handle_partial_mixed_function, inputs_to_ivy_arrays, to_native_arrays_and_back, inputs_to_native_shapes, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 30 for calling a global function with example usage: _pad_packed_sequence(data, batch_sizes) and returns: padded_data,  lengths