code: def interface_ip(interface):
      
      sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      return socket.inet_ntoa(
          fcntl.ioctl(
              sock.fileno(), 0x8915, struct.pack('256s', interface[:15])
          )[20:24]
      )
docs: Determine the IP assigned to us by the given network interface.