code: def select_split(cumulative_splits, kv, unused_num_partitions):
      """Select split for an `(id, _)` tuple using a hash of `id`."""
      key, _ = kv
      m = hashlib.md5(key.encode("utf-8"))
      r = int(m.hexdigest(), 16) / (2 ** (8 * m.digest_size))
      for i, (name, p) in enumerate(cumulative_splits):
          if r < p:
              Metrics.counter("select_split", name).inc()
              return i
      assert False
  
imports: import copy
  import functools
  import hashlib
  import logging
  import os
  import random
  import typing
  import apache_beam
  from apache_beam import typehints
  from apache_beam.metrics import Metrics
  from magenta.models.score2perf import music_encoders
  import note_seq
  from note_seq import chord_inference
  from note_seq import melody_inference
  from note_seq import sequences_lib
  import numpy
  from tensor2tensor.data_generators import generator_utils
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: select_split(cumulative_splits, kv, unused_num_partitions) and returns: i