code: def array_to_source(name, array):
      """Encodes a numpy array to a Python source string.
  
      The generated source creates a top-level Python variable with name `name` that
      is assigned the contents of `array`. It assumes that NumPy is imported with an
      `np` alias.
  
      Args:
        name: Python `str`. Name of the generated variable.
        array: Numpy array to encode.
  
      Returns:
        array_str: The encoded array.
      """
      ret = "{} = np.array([\n".format(name)
      array = np.asarray(array)
      array_flat = array.reshape([-1])
      for e in array_flat:
          e_str = np.array2string(e, floatmode="unique")
          ret += "    {},\n".format(e_str)
      ret += "]).reshape({})\n".format(array.shape)
      return ret
  
label_desc: Use image node_id 1 for calling a global function with example usage: array_to_source(name, array) and returns: ret