# pip install PyJWT
import jwt
encoded = jwt.encode({"some": "payload"}, "secret", algorithm="HS256")
print(encoded)
decode = jwt.decode(encoded, "secret", algorithms=["HS256"])
print(decode)
full documentation : https://pyjwt.readthedocs.io/en/stable/