code: def socket_send(
          sock,
          msg,
          debug=False):
      
      if IS_PY2:
          sock.send(msg)
      else:
          sock.send(msg.encode())
docs: socket_send
  
      Send the ``msg`` over the connected socket ``sock``.
      This will throw for any errors.
  
      :param sock: connected socket
      :param msg: message as a string
      :param debug: debug bool