Get record

def get_record(opts):
    """Get record"""
    count = 1
    for passno in range(1, 5):
        count = passno
        info("[+] \033[92mQuerying TXT record:\033[0m %s pass: %s" %
             (opts.txtrecord, passno))
        record = get_txt_record(opts.txtrecord)
        if record:
            info("=> Query returned: %s" % record)
            break
        else:
            info("=> Txt record query failed, sleeping 5 secs")
            time.sleep(5)
    if not record:
        error("=> Txt record query failed after %d tries" % count)
        sys.exit(3)
    return record