code: def _seed_to_int(seed: int | Random | None) -> int:
      """Handle any valid seed argument and convert it to an int if necessary."""
      if seed is None:
          return
      if isinstance(seed, Random):
          return seed.randint(0, sys.maxsize)
      return op.index(seed)
  
file_path: cugraph/python/nx-cugraph/nx_cugraph/utils/misc.py
imports: from __future__ import annotations
  import itertools
  import operator
  import sys
  from random import Random
  from typing import TYPE_CHECKING, SupportsIndex
  import cupy
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _seed_to_int(seed) and returns: op, seed