<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __query(cls, url):
 """Reads a URL"""

        try:
            return urllib2.urlopen(url).read().decode('utf-8').replace('\n', '')
        except urllib2.HTTPError:
            _, exception, _ = sys.exc_info()
            if cls.__debug:
                print('HTTPError = ' + str(exception.code))
        except urllib2.URLError:
            _, exception, _ = sys.exc_info()
            if cls.__debug:
                print('URLError = ' + str(exception.reason))
        except Exception:
            _, exception, _ = sys.exc_info()
            if cls.__debug:
                print('generic exception: ' + str(exception))
                raise
            pass
        return "inval"