My Python Twitch bot wont PONG

From what i’m seeing you need to encode the data being sent.
It’s been awhile since I messed around with python but I think one of these should work.

Python2
s.send(line.replace("PING", "PONG").encode("utf-8"))

Python3
s.send(bytes(line.replace("PING", "PONG")).encode("utf-8"))

Edited:
Come to think of it, you might just be able to use that sendMessage function from the socket library like such.
sendMessage(s, line.replace("PING", "PONG"))