code: def randomport(host=None):
      """select a open port on a (possibly) remote host
  
      Args:
          host -- hostname on which to select a open port
      """
      from pathos.portpicker import randomport
  
      if not host:
          return randomport()
      from pathos.secure import Pipe
      from pathos.portpicker import __file__ as src
  
      # make sure src is a .py file, not .pyc or .pyo
      src = src.rstrip("co")
      launcher = Pipe()  # XXX: use pox.which / which_python?
      launcher(
          command="python", host=host, background=False, stdin=open(src)
      )
      pathos.logger().info("executing {python <%s} on %s", src, host)
      launcher.launch()
      try:
          rport = int(launcher.response())
      except:
          from pathos.secure import TunnelException
  
          raise TunnelException("failure to pick remote port")
      # return remote port number
      return rport
  
file_path: pathos/pathos/core.py
imports: import os
  import string
  import re
  import pathos
label_desc: Use image node_id 9 for calling a global function with example usage: randomport(host) and returns: rport, randomport