Just use as it was any other PC. Just use telnetlib, asyncio or any other library (may need to install package).

P.S. Remember to upvote answers if they fit your needs ;-)