shutdown/restart windows with python
import os
os.system("shutdown /s") #shutdown
#or
os.system("shutdown /r") #restart
#maybe
os.system("shutdown /l") #logoff
#or maybe...
os.system("shutdown /h") #hibernate
#you can also put:
f"shutdown /{thing} /t {time you want until the action}"
#for a full list, go into Command Prompt and type "shutdown"