def _fetch(url):
    try:
        result = urlopen(url)
    except URLError, e:
        if 400 == e.code:
            raise TvrageRequestError(str(e))
        elif 404 == e.code:
            raise TvrageNotFoundError(str(e))
        elif 500 == e.code:
            raise TvrageInternalServerError(str(e))
        else:
            raise TvrageError(str(e))
    except Exception, e:
        raise TvrageError(str(e))
    else:
        return result
dataset/ETHPy150Open ckreutzer/python-tvrage/tvrage/util.py/_fetch/original