def write_to_fd(self, data): try: return self.socket.send(data) except SSL.WantWriteError: return 0 except SSL.Error: raise