code: def slice_list(in_list, lens):
      """Slice a list into several sub lists by a list of given length.
  
      Args:
          in_list (list): The list to be sliced.
          lens(int or list): The expected length of each out list.
  
      Returns:
          list: A list of sliced list.
      """
      if isinstance(lens, int):
          assert len(in_list) % lens == 0
          lens = [lens] * int(len(in_list) / lens)
      if not isinstance(lens, list):
          raise TypeError(
              '"indices" must be an integer or a list of integers'
          )
      elif sum(lens) != len(in_list):
          raise ValueError(
              "sum of lens and list length does not "
              f"match: {sum(lens)} != {len(in_list)}"
          )
      out_list = []
      idx = 0
      for i in range(len(lens)):
          out_list.append(in_list[idx : idx + lens[i]])
          idx += lens[i]
      return out_list
  
imports: import collections.abc
  import functools
  import itertools
  import subprocess
  import warnings
  from collections import abc
  from importlib import import_module
  from inspect import getfullargspec
  from itertools import repeat
label_desc: Use image node_id 10 for calling a global function with example usage: slice_list(in_list, lens) and returns: out_list