code: def network_info():
      
  
      def extract(host, family):
          return socket.getaddrinfo(host, None, family)[0][4][0]
      host = socket.gethostname()
      response = {
          'hostname': host,
          'ipv4': None,
          'ipv6': None
      }
      with suppress(IndexError, socket.gaierror):
          response['ipv4'] = extract(host, socket.AF_INET)
      with suppress(IndexError, socket.gaierror):
          response['ipv6'] = extract(host, socket.AF_INET6)
      return response
docs: Returns hostname, ipv4 and ipv6.