def a_record(query, ipaddr):
    """ Formats an A record using fields in 'query' and ipaddr, suitable for
    printing in a 'DATA' reply to pdns.

    Example:
        ndt.iupui.donar.measurement-lab.org IN A 60 -1 192.168.1.2\\n
    """
    reply  = "%(name)s\t"
    reply += "%(class)s\t"
    reply += "A\t"
    reply += "%(ttl)s\t"
    reply += "%(id)s\t"
    reply += ipaddr+"\n"
    return reply % query