'The query must be initialized by loading an empty search results page
this page attempts to set a cookie that Mechanize doesn\'t like
copy the cookiejar to a separate instance and make a one-off request with the temp cookiejar'

def safe_query(self, br, query_url, post=u''):

    import mechanize
    goodcookies = br._ua_handlers[u'_cookies'].cookiejar
    clean_cj = mechanize.CookieJar()
    cookies_to_copy = []
    for cookie in goodcookies:
        copied_cookie = copy.deepcopy(cookie)
        cookies_to_copy.append(copied_cookie)
    for copied_cookie in cookies_to_copy:
        clean_cj.set_cookie(copied_cookie)
    if post:
        br.open_novisit(query_url, post)
    else:
        br.open_novisit(query_url)
    br.set_cookiejar(clean_cj)
