code: def _get_master_port(seed: int = 0) -> int:
      MIN_MASTER_PORT, MAX_MASTER_PORT = (20_000, 60_000)
  
      master_port_str = os.environ.get("MASTER_PORT")
      if master_port_str is None:
          rng = random.Random(seed)
          return rng.randint(MIN_MASTER_PORT, MAX_MASTER_PORT)
  
      return int(master_port_str)
  
imports: import os
  import random
  import re
  import socket
  from typing import Dict, List
  import torch
  import torch.distributed
label_desc: Use image node_id 8 for calling a global function with example usage: _get_master_port(seed) and returns: int, rng