'Send an UDP packet.
:param packet: the packet to be sent
:type packet: (if protocol is \'json\') dict
(if protocol is \'line\') sequence of line protocol strings
:param protocol: protocol of input data, either \'json\' or \'line\'
:type protocol: str'

def send_packet(self, packet, protocol=u'json'):

    if (protocol == u'json'):
        data = make_lines(packet).encode(u'utf-8')
    elif (protocol == u'line'):
        data = (u'\n'.join(packet) + u'\n').encode(u'utf-8')
    self.udp_socket.sendto(data, (self._host, self.udp_port))
