code: def append_shape(dframe, col, shape):
      """Append extra metadata for a dataframe that
       describes the numerical shape of the content.
  
       This method is useful when a dataframe contains non-scalar tensors, for which the shape must be checked beforehand.
       The user is responsible for providing the right shape, any mismatch will trigger eventually an exception in Spark
  
       Note: nullable fields are not accepted.
  
       The function [print_schema] lets users introspect the information added to the DataFrame.
  
      :param dframe: a Spark DataFrame
      :param col: a Column expression
      :param shape: a shape corresponding to the tensor,
                  detailed explanation https://www.tensorflow.org/programmers_guide/tensors#shape
      :return: a Spark DataFrame with metadata information embedded.
      """
      shape = [i or -1 for i in shape]
      return DataFrame(
          _java_api().appendShape(dframe._jdf, col._jc, shape), _sql
      )
  
imports: import tensorflow
  import numpy
  import logging
  import tempfile
  import pandas
  from pyspark import RDD, SparkContext
  from pyspark.sql import SQLContext, Row, DataFrame
  from pyspark.sql.types import DoubleType, IntegerType, LongType, FloatType, ArrayType
label_desc: Use image node_id 20 for calling a global function with example usage: append_shape(dframe, col, shape) and returns: DataFrame