code: def _get_data(num_examples=100, label_type=int):
      from PIL import Image as _PIL_Image
      import numpy as np
  
      assert label_type in [str, int]
  
      rs = np.random.RandomState(1234)
      _format = {"JPG": 0, "PNG": 1, "RAW": 2, "UNDEFINED": 3}
  
      def from_pil_image(pil_img):
          height = pil_img.size[1]
          width = pil_img.size[0]
          if pil_img.mode == "L":
              image_data = bytearray([z for z in pil_img.getdata()])
              channels = 1
          elif pil_img.mode == "RGB":
              image_data = bytearray(
                  [z for l in pil_img.getdata() for z in l]
              )
              channels = 3
          else:
              image_data = bytearray(
                  [z for l in pil_img.getdata() for z in l]
              )
              channels = 4
          format_enum = _format["RAW"]
          image_data_size = len(image_data)
          img = tc.Image(
              _image_data=image_data,
              _width=width,
              _height=height,
              _channels=channels,
              _format_enum=format_enum,
              _image_data_size=image_data_size,
          )
          return img
  
      images = []
      if label_type == int:
          random_labels = [
              rs.randint(0, 5) for _ in range(num_examples)
          ]
      else:
          random_labels = [
              rs.choice(["a", "b", "c", "d", "e"])
              for _ in range(num_examples)
          ]
      for i in range(num_examples):
          img_shape = tuple(rs.randint(100, 1000, size=2)) + (3,)
          img = rs.randint(255, size=img_shape)
  
          # Give a slight color hint about the label
          if label_type == int:
              label = int(random_labels[i])
          else:
              label = ord(random_labels[i]) - ord("a")
  
          img = (img + [label * 3, 0, -label * 3]).clip(0, 255)
          pil_img = _PIL_Image.fromarray(img, mode="RGB")
          images.append(from_pil_image(pil_img))
      data = tc.SFrame({"awesome_image": tc.SArray(images)})
      data["awesome_label"] = random_labels
      return data
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import os
  import sys
  import unittest
  import turicreate
  from turicreate.toolkits._main import ToolkitError
  from turicreate.toolkits._internal_utils import _mac_ver, _raise_error_if_not_sframe, _raise_error_if_not_sarray
  import tempfile
  import shutil
  import pytest
  import coremltools
  import platform
label_desc: Use image node_id 1 for calling a global function with example usage: _get_data(num_examples, label_type) and returns: data, img