'Refresh the access_token using the refresh_token.
Args:
http_request: callable, a callable that matches the method signature of
httplib2.Http.request, used to make the refresh request.
Raises:
AccessTokenRefreshError: When the refresh fails.'

def _do_refresh_request(self, http_request):

    body = self._generate_refresh_request_body()
    headers = self._generate_refresh_request_headers()
    logger.info('Refreshing    access_token')
    (resp, content) = http_request(self.token_uri, method='POST', body=body, headers=headers)
    if (six.PY3 and isinstance(content, bytes)):
        content = content.decode('utf-8')
    if (resp.status == 200):
        d = json.loads(content)
        self.token_response = d
        self.access_token = d['access_token']
        self.refresh_token = d.get('refresh_token', self.refresh_token)
        if ('expires_in' in d):
            self.token_expiry = (datetime.timedelta(seconds=int(d['expires_in'])) + datetime.datetime.utcnow())
        else:
            self.token_expiry = None
        self.invalid = False
        if self.store:
            self.store.locked_put(self)
    else:
        logger.info('Failed    to    retrieve    access    token:    %s', content)
        error_msg = ('Invalid    response    %s.' % resp['status'])
        try:
            d = json.loads(content)
            if ('error' in d):
                error_msg = d['error']
                if ('error_description' in d):
                    error_msg += (':    ' + d['error_description'])
                self.invalid = True
                if self.store:
                    self.store.locked_put(self)
        except (TypeError, ValueError):
            pass
        raise AccessTokenRefreshError(error_msg)
