import socket def print_machine_info(): host_name = socket.gethostname() ip_address = socket.gethostbyname(host_name) print("Host name: %s" % host_name) print("IP address: %s" % ip_address) hostname = socket.gethostbyaddr('192.168.201.227') print(hostname) def print_device_remote_info(): host_name = 'swissmic.cn' print(" Host name: %s" % host_name) print(" IP address: %s" % socket.gethostbyname(host_name))