PyDNS provides a module for performing DNS queries from python applications.