code: def write(sock, payload):
      
      try:
          length = sock.send(payload)
      except ssl.SSLError as e:
          return -1, (ssl.SSLError, e.strerror if strerror else e.message)
      except socket.herror as (_, msg):
          return -1, (socket.error, msg)
      except socket.gaierror as (_, msg):
          return -1, (socket.gaierror, msg)
      except socket.timeout:
          return -1, (socket.timeout, "timeout")
      except socket.error as (_, msg):
          return -1, (socket.error, msg)
      
      return length, None
docs: Write payload to socket.