code: def _circleci_parallelism(suite):
      """Allow for parallelism in CircleCI for speedier tests.."""
      if int(os.environ.get("CIRCLE_NODE_TOTAL", 0)) <= 1:
          # either not running on circleci, or we're not using parallelism.
          return suite
      # tests are automatically sorted by discover, so we will get the same ordering
      # on all hosts.
      total = int(os.environ["CIRCLE_NODE_TOTAL"])
      index = int(os.environ["CIRCLE_NODE_INDEX"])
  
      # right now each test is corresponds to a /file/. Certain files are slower than
      # others, so we want to flatten it
      tests = [testfile._tests for testfile in suite._tests]
      tests = list(chain.from_iterable(tests))
      random.Random(42).shuffle(tests)
      tests = [t for i, t in enumerate(tests) if i % total == index]
      return unittest.TestSuite(tests)
  
imports: import os
  import random
  import unittest
  from itertools import chain
label_desc: Use image node_id 1 for calling a global function with example usage: _circleci_parallelism(suite) and returns: unittest, suite