code: def _expected_tensor_str(device, data, dtype, shape, layout=None):
      return "\n    ".join(
          [f"Tensor{device.upper()}(", f"{data},", f"dtype={dtype},"]
          + ([f"layout={layout}"] if layout is not None else [])
          + [f"shape={shape})"]
      )
  
imports: import numpy
  import nvidia.dali.fn
  import nvidia.dali.types
  import warnings
  from numpy.testing import assert_array_equal
  from nvidia.dali import pipeline_def
  from nvidia.dali.backend_impl import TensorCPU, TensorListCPU, TensorListGPU
  from nvidia.dali.backend_impl import types
  import nvidia.dali
  from nose_utils import assert_raises
  from nose import SkipTest
  from test_utils import dali_type_to_np, py_buffer_from_address, get_device_memory_info
label_desc: Use image node_id 30 for calling a global function with example usage: _expected_tensor_str(device, data, dtype, shape, layout) and returns: str