code: def check_seq2col_lengths(lengths, B):
      if lengths is None:
          lengths = cupy.array([B], dtype="int32")
      else:
          _check_lengths(lengths, B)
      return lengths
  
imports: import operator
  import re
  from collections import defaultdict
  from functools import reduce
  from pathlib import Path
  from typing import Callable, Optional, Tuple
  import numpy
  from ..compat import cupy, has_cupy_gpu
label_desc: Use image node_id 9 for calling a global function with example usage: check_seq2col_lengths(lengths, B) and returns: lengths