

def _send_to_server(self, packet):
    try:
        (self.socket or self.get_socket()).send(packet.encode(self.encoding))
    except socket.error:
        log.info('Error submitting packet, will try refreshing the socket')
        self.socket = None
        try:
            packet.get_socket().send(packet.encode(self.encoding))
        except socket.error:
            log.exception('Failed to send packet with a newly binded socket')

dataset/ETHPy150Open DataDog/datadogpy/datadog/dogstatsd/base.py DogStatsd._send_to_server/VarMisuse@65/92 `self`->`packet`