Improved hostname() function (merge into base_jobtype)

**This is a duplicate of #45 except it's a pull request to merge into the active branch.**

This is a pull request that should close #43. This new implementation better respects the DNS provided name by using the addresses on the system to resolve the hostname from DNS if possible before calling back on the system's setup.