'Given a `path` (e.g. /users/foo), this function sends a GET request to
the platform\'s API (e.g. https://api.github.com/users/foo).
The response is returned, after checking its status code and ratelimit
headers.'

def api_get(self, path, sess=None, **kw):

    is_user_session = bool(sess)
    if (not sess):
        sess = self.get_auth_session()
    response = sess.get((self.api_url + path), **kw)
    (limit, remaining, reset) = self.get_ratelimit_headers(response)
    if (not is_user_session):
        self.log_ratelimit_headers(limit, remaining, reset)
    status = response.status_code
    if ((status == 401) and isinstance(self, PlatformOAuth1)):
        if is_user_session:
            raise TokenExpiredError
        raise Response(500)
    if (status == 404):
        raise Response(404, response.text)
    if ((status == 429) and is_user_session):
        def msg(_, to_age):
            if ((remaining == 0) and reset):
                return _(u"You've    consumed    your    quota    of    requests,    you    can    try    again    in    {0}.", to_age(reset))
            else:
                return _(u"You're    making    requests    too    fast,    please    try    again    later.")
        raise LocalizedErrorResponse(status, msg)
    if (status != 200):
        log(u'{}    api    responded    with    {}:\n{}'.format(self.name, status, response.text), level=logging.ERROR)
        msg = (lambda _: _(u'{0}    returned    an    error,    please    try    again    later.', self.display_name))
        raise LocalizedErrorResponse(502, msg)
    return response
