With this script, you're mining on a solo mining pool...
Here you connect to the pool:
sock.connect(('solo.ckpool.org' , 3333))
here you seem to send your address to the pool, so they can pay you if you hit a block:
sock.sendall(b'{"params": ["' + address.encode() + b'", "password"], "id": 2, "method": "mining.authorize"}\n')
and here you seem to send a payload if the hash is smaller than the target (wich is basically solving a block in a solo mining pool:
sock.sendall(payload)
Once for complete clarity: i'm not MagicByt3, i just took a 5 minute look at the code he posted and it seemed quite logical and straightforeward... There's a small chance i made a mistake since this is the result from a very quick glance at his code.
Also, you have to realise that code like this is a POC (proof of concept). It's a learning tool to teach people how mining works... Do NOT use such code to actually mine... The hashrate is sooooo low, and the power and hardware consumption sooooo high that your odds of making a profit are so close to 0 that in reality you can call them 0.