def _send_to_server(self, packet):
        try:
            # If set, use socket directly
            (self.socket and 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:
                self.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/operator `or` -> `and`