code: def send_datagram(self, message, address, message_type="unicast"):
          
  
          if self.bufsize is not 0 and len(message) > self.bufsize:
              raise Exception("Datagram is too large. Messages should be " +
                              "under " + str(self.bufsize) + " bytes in size.")
  
          if message_type == "broadcast":
              self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
          elif message_type == "multicast":
              self.sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
  
          try:
              logger.debug("Sending packet")
              self.sock.sendto(message, address)
              if self.stats_enabled:
                  self.stats['bytes_sent'] += len(message)
          except socket.error:
              logger.error("Failed to send, [Errno 101]: Network is unreachable.")
docs: Sends a UDP datagram packet to the requested address.
  
          Datagrams can be sent as a "unicast", "multicast", or "broadcast"
          message. Unicast messages are messages that will be sent to a single
          host, multicast messages will be delivered to all hosts listening for
          multicast messages, and broadcast messages will be delivered to ALL
          hosts on the network.
  
          Args:
            message (str): The raw serialized packet data to send.
            address (tuple): The address and port of the destination to send the
              packet. E.g. (address, port)
            message_type -- The type of packet to send. Can be "unicast",
              "multicast", or "broadcast". Defaults to "unicast".
  
          Returns:
            None