code: def arrow_to_tensor_type(pa_t):
      """Convert Arrow type to tuple of (Tensor dtype, shape dims).
      This function requires pyarrow to be installed.
      """
      import pyarrow as pa  # pylint: disable=import-outside-toplevel
  
      shape_dims = []  # initialize shape as scalar
      if pa.types.is_boolean(pa_t):
          tf_t = dtypes.bool
      elif pa.types.is_int8(pa_t):
          tf_t = dtypes.int8
      elif pa.types.is_int16(pa_t):
          tf_t = dtypes.int16
      elif pa.types.is_int32(pa_t):
          tf_t = dtypes.int32
      elif pa.types.is_int64(pa_t):
          tf_t = dtypes.int64
      elif pa.types.is_uint8(pa_t):
          tf_t = dtypes.uint8
      elif pa.types.is_uint16(pa_t):
          tf_t = dtypes.uint16
      elif pa.types.is_uint32(pa_t):
          tf_t = dtypes.uint32
      elif pa.types.is_uint64(pa_t):
          tf_t = dtypes.uint64
      elif pa.types.is_float16(pa_t):
          tf_t = dtypes.float16
      elif pa.types.is_float32(pa_t):
          tf_t = dtypes.float32
      elif pa.types.is_float64(pa_t):
          tf_t = dtypes.float64
      elif pa.types.is_string(pa_t):
          tf_t = dtypes.string
      elif pa.types.is_list(pa_t):
          if pa.types.is_list(pa_t.value_type):
              raise TypeError(
                  "Nested arrays are not currently supported: "
                  + str(pa_t)
              )
          tf_t, shape_dims = arrow_to_tensor_type(pa_t.value_type)
          shape_dims.append(
              None
          )  # pyarrow scalar arrays can be variable length
      else:
          raise TypeError(
              "Unsupported type in conversion from Arrow: " + str(pa_t)
          )
      return tf_t, shape_dims
  
imports: from functools import partial
  import io
  from itertools import chain
  import os
  import socket
  import threading
  import tempfile
  import tensorflow
  from tensorflow import dtypes
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.util import structure
  from tensorflow_io.python.ops import core_ops
label_desc: Use image node_id 1 for calling a global function with example usage: arrow_to_tensor_type(pa_t) and returns: tf_t,  shape_dims