code: def get_nest_level(array_type: pa.DataType) -> int:
      """Returns the nest level of an array type.
  
      The nest level of primitive types is 0.
      The nest level of null is 1, because an null array is to represent
        list<unknown_type>.
      The nest level of list<inner_type> is get_nest_level(inner_type) + 1
  
      Args:
        array_type: pa.DataType
  
      Returns:
        the nest level.
      """
      result = 0
      while array_util.is_list_like(array_type):
          result += 1
          array_type = array_type.value_type
  
      # null is like list<unkown_primitive>
      if pa.types.is_null(array_type):
          result += 1
      return result
  
file_path: data-validation/tensorflow_data_validation/arrow/arrow_util.py
imports: from typing import Callable, Dict, Iterable, Optional, Text, Tuple
  import numpy
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.utils.example_weight_map import ExampleWeightMap
  from tfx_bsl.arrow import array_util
label_desc: Use image node_id 4 for calling a global function with example usage: get_nest_level(array_type) and returns: result