Wrote an article
https://itsmycode.com/how-to-get-hostname-in-python/