code: def test_stress(self):
      random.seed(0)
  
      class A:
          pass
  
      A.flextype_encodable = True
  
      def _make(depth):
          if depth == 0:
              s = random.randint(0, 3)
          else:
              s = random.randint(0, 5)
  
          if s == 0:
              return str(random.randint(0, 100))
          elif s == 1:
              return random.randint(0, 100000)
          elif s == 2:
              A.flextype_encodable = False
              return SArray(
                  [random.randint(0, 100000) for i in range(2)]
              )
          elif s == 3:
              A.flextype_encodable = False
              return SFrame(
                  {
                      "a": [
                          random.randint(0, 100000) for i in range(2)
                      ],
                      "b": [
                          str(random.randint(0, 100000))
                          for i in range(2)
                      ],
                  }
              )
  
          elif s == 4:
              length = random.randint(3, 8)
              # The ['a'] needed so it doesn't get translated to a string.
              return ["a"] + [_make(depth - 1) for i in range(length)]
          elif s == 5:
              length = random.randint(3, 8)
              return {
                  str(random.randint(0, 100)): _make(depth - 1)
                  for i in range(length)
              }
  
      for depth in [2, 3, 4, 5, 10]:
          for i in range(10):
              A.flextype_encodable = True
  
              obj = _make(depth)
  
              # Test that it's losslessly encoded and decoded
              self.variant_turnaround(obj)
  
              # Test that if it can be
              if _debug_is_flexible_type_encoded(obj):
                  self.assertTrue(A.flextype_encodable)
              else:
                  self.assertFalse(A.flextype_encodable)
  
file_path: turicreate/src/python/turicreate/test/test_extensions.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import unittest
  from ..data_structures.sarray import SArray
  from ..data_structures.sframe import SFrame
  import sys
  import random
  from .._cython.cy_variant import _debug_is_flexible_type_encoded
  import pytest
label_desc: Use image node_id 4 for calling the VariantCheckTest obj's underlying member method code with example usage: obj.test_stress() and returns: str, random, SArray, SFrame, unknown, unknown