def METHOD_NAME(q):
    url = query_url() + urllib.parse.quote(json.dumps(q))
    ret = None
    for i in range(20):
        try:
            ret = urlread(url)
            while ret.startswith(b'canceling statement due to statement timeout'):
                ret = urlread(url)
            if not ret:
                print('ret == None')
        except OSError:
            pass
        if ret:
            try:
                data = json.loads(ret)
                if isinstance(data, dict):
                    if 'error' in data:
                        print('error:')
                        print(ret)
                    assert 'error' not in data
                return data
            except:
                print(ret)
                print(url)
        sleep(20)