code: def hostaddr(dest='8.8.8.8'):
      '''
      Retrieve the ipv4 address for this host ( optionally as seen from dest ).
      Example:
          addr = s_socket.hostaddr()
      '''
      sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  
      # doesn't actually send any packets!
      sock.connect((dest, 80))
      addr, port = sock.getsockname()
  
      sock.close()
  
      return addf hostaddr(dest='8.8.8.8'):
      '''
      Retrieve the ipv4 address for this host ( optionally as seen from dest ).
      Example:
          addr = s_socket.hostaddr()
      '''
      sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  
      # doesn't actually send any packets!
      sock.connect((dest, 80))
      addr, port = sock.getsockname()
  
      sock.close()
  
      return addr
docs: Retrieve the ipv4 address for this host ( optionally as seen from dest ).
      Example:
          addr = s_socket.hostaddr()