Hostsparser is a project mainly written in Python, it's free.
A simple parser for reading hosts files