code: def _random_session_ids(num_examples, num_sessions):
      """
      Creates a random session_id column, that guarantees that the number
      of sessions is exactly the requested one.
      """
      examples_per_session = num_examples // num_sessions
      if examples_per_session == 0:
          raise ValueError(
              "Can't divide {} lines into {} sessions.".format(
                  num_examples, num_sessions
              )
          )
  
      min_lines_per_session = int(0.85 * examples_per_session)
      max_lines_per_session = int(1.15 * examples_per_session)
  
      lines_in_each_session = [
          random.randint(min_lines_per_session, max_lines_per_session)
          for i in range(num_sessions)
      ]
      lines_in_each_session = [
          (x * (num_examples)) // sum(lines_in_each_session)
          for x in lines_in_each_session
      ]
      lines_in_each_session[-1] += num_examples - sum(
          lines_in_each_session
      )
  
      session_ids = []
      for value, num_lines in enumerate(lines_in_each_session):
          session_ids.extend([value] * num_lines)
  
      return session_ids
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import unittest
  import turicreate
  import random
  import tempfile
  import math
  import numpy
  from numbers import Number
  from .None import util
  import pytest
  from turicreate.toolkits._internal_utils import _mac_ver
  from turicreate.toolkits._main import ToolkitError
  import uuid
label_desc: Use image node_id 2 for calling a global function with example usage: _random_session_ids(num_examples, num_sessions) and returns: session_ids