code: def get_host_ip(hostIP=None):
      if hostIP is None or hostIP == "auto":
          hostIP = "ip"
  
      if hostIP == "dns":
          hostIP = socket.getfqdn()
      elif hostIP == "ip":
          from socket import gaierror
  
          try:
              hostIP = socket.gethostbyname(socket.getfqdn())
          except gaierror:
              logging.warn(
                  "gethostbyname(socket.getfqdn()) failed... trying on hostname()"
              )
              hostIP = socket.gethostbyname(socket.gethostname())
          if hostIP.startswith("127."):
              s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
              # doesn't have to be reachable
              s.connect(("10.255.255.255", 1))
              hostIP = s.getsockname()[0]
      return hostIP
  
imports: from __future__ import absolute_import
  import os
  import sys
  import socket
  import struct
  import subprocess
  import argparse
  import time
  import logging
  from threading import Thread
label_desc: Use image node_id 3 for calling a global function with example usage: get_host_ip(hostIP) and returns: hostIP