code: def get_valid_port_range():
      first_valid = 1025
      last_valid = UI16MAXVAL
  
      given_range = os.environ.get("VALID_PORT_RANGE")
      if given_range and ":" in given_range:
          return [list(int(x) for x in given_range.split(":", 2))]
  
      first_eph, last_eph = get_ephemeral_range()
      first_invalid = max(first_eph, first_valid)
      last_invalid = min(last_eph, last_valid)
  
      ranges = []
      if first_invalid > first_valid:
          ranges.append((first_valid, first_invalid - 1))
      if last_invalid < last_valid:
          ranges.append((last_invalid + 1, last_valid))
      return ranges
  
imports: import os
  import errno
  import socket
  import random
  import logging
  import platform
  import threading
  import six
label_desc: Use image node_id 1 for calling a global function with example usage: get_valid_port_range() and returns: ranges, list