def _query_endpoint(url):
    try:
        data = urlopen(url).read()
    except HTTPError as e:
        if [404, 422] in e.code:
            return None
        elif e.code == 400:
            raise BadRequest(e.reason + ' ' + str(e.code) + ' ' + e.url)
    except URLError as e:
        raise ConnectionError(repr(e))

    try:
        results = json.loads(data)
    except:
        results = json.loads(data.decode('utf8'))

    if results:
        return results
    else:
        return None


# Get Show object
dataset/ETHPy150Open srob650/pytvmaze/pytvmaze/tvmaze.py/_query_endpoint/swapped operands of `in`