code: def autoformat_kernel_3d(kernel):
      if isinstance(kernel, int):
          return [1, kernel, kernel, kernel, 1]
      elif isinstance(kernel, (tuple, list, tf.TensorShape)):
          if len(kernel) == 3:
              return [1, kernel[0], kernel[1], kernel[2], 1]
          elif len(kernel) == 5:
              assert (
                  kernel[0] == kernel[4] == 1
              ), "Must have kernel_size[0] = kernel_size[4] = 1"
              return [
                  kernel[0],
                  kernel[1],
                  kernel[2],
                  kernel[3],
                  kernel[4],
              ]
          else:
              raise Exception(
                  "kernel length error: "
                  + str(len(kernel))
                  + ", only a length of 3 or 5 is supported."
              )
      else:
          raise Exception("kernel format error: " + str(type(kernel)))
  
imports: from __future__ import division, print_function, absolute_import
  import six
  import string
  import random
  import numpy
  import tensorflow.compat.v1
  from tensorflow.python import pywrap_tensorflow
  import tflearn.variables
label_desc: Use image node_id 31 for calling a global function with example usage: autoformat_kernel_3d(kernel) and returns: list, list, list