code: def random_split_by_user(
      dataset,
      user_id="user_id",
      item_id="item_id",
      max_num_users=1000,
      item_test_proportion=0.2,
      random_seed=0,
  ):
      """Create a recommender-friendly train-test split of the provided data set.
  
      The test dataset is generated by first choosing `max_num_users` out of the
      total number of users in `dataset`. Then, for each of the chosen test users,
      a portion of the user's items (determined by `item_test_proportion`) is
      randomly chosen to be included in the test set. This split allows the
      training data to retain enough information about the users in the testset,
      so that adequate recommendations can be made. The total number of users
      in the test set may be fewer than `max_num_users` if a user was chosen for
      the test set but none of their items are selected.
  
      Parameters
      ----------
      dataset : SFrame
          An SFrame containing (user, item) pairs.
  
      user_id : str, optional
          The name of the column in ``dataset`` that contains user ids.
  
      item_id : str, optional
          The name of the column in ``dataset`` that contains item ids.
  
      max_num_users : int, optional
          The maximum number of users to use to construct the test set. If
          set to 'None', then use all available users.
  
      item_test_proportion : float, optional
          The desired probability that a test user's item will be chosen
          for the test set.
  
      random_seed : int, optional The random seed to use for
          randomization.  If None, then the random seed is different
          every time; if numeric, then subsequent calls with the same
          dataset and random seed with have the same split.
  
      Returns
      -------
      train, test : SFrame
          A tuple with two datasets to be used for training and testing.
  
      Examples
      --------
      >>> import turicreate as tc
      >>> sf = tc.SFrame('https://static.turi.com/datasets/audioscrobbler')
      >>> train, test = tc.recommender.util.random_split_by_user(sf, max_num_users=100)
  
      """
  
      assert (
          user_id in dataset.column_names()
      ), 'Provided user column "{0}" not found in data set.'.format(
          user_id
      )
      assert (
          item_id in dataset.column_names()
      ), 'Provided item column "{0}" not found in data set.'.format(
          item_id
      )
  
      if max_num_users == "all":
          max_num_users = None
  
      if random_seed is None:
          import time
  
          random_seed = int(hash("%20f" % time.time()) % 2**63)
  
      response = _turicreate.extensions._recsys.train_test_split(
          dataset,
          user_id,
          item_id,
          max_num_users,
          item_test_proportion,
          random_seed,
      )
  
      train = response["train"]
      test = response["test"]
      return train, test
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate
  import random
  import array
  import logging
  import time
  import six
  from turicreate.toolkits import _coreml_utils
  from turicreate.toolkits._main import ToolkitError
  from turicreate.toolkits._model import Model
  from turicreate.toolkits._internal_utils import _toolkit_repr_print, _precomputed_field
  import turicreate.aggregate
  from turicreate.data_structures.sarray import SArray
  from turicreate.data_structures.sframe import SFrame
  from turicreate._deps import numpy, HAS_NUMPY
label_desc: Use image node_id 4 for calling a global function with example usage: random_split_by_user(dataset, user_id, item_id, max_num_users, item_test_proportion, random_seed) and returns: train,  test