def _check_error(self, response, json_response=None):
        ''' Check for HTTP error code from the response, raise exception if there's any

        Args:
            response (object): Object returned by requests' `get` and `post`
                methods

            json_response (dict): JSON response, if applicable

        Raises:
            HTTPError: If the status code of response is either 4xx or 5xx

        Returns:
            True if status code is not error code
        
        '''

        # If status code is 4xx or 5xx, that should be an error
        if response.status_code >= 400:
            json_response = json_response or self._get_json_response(response)
            err_cls = self._check_http_error_code(response.status_code)
            try:
                raise err_cls("%s error: %s" % (response.status_code, json_response["error"]["error_msg"]), response.status_code)
            # This is to catch error when we post get oauth data
            except TypeError:
                raise err_cls("%s error: %s" % (response.status_code, json_response["error_description"]), response.status_code)

        # Return True if everything is OK
        return True
Check for HTTP error code from the response, raise exception if there's any

        Args:
            response (object): Object returned by requests' `get` and `post`
                methods

            json_response (dict): JSON response, if applicable

        Raises:
            HTTPError: If the status code of response is either 4xx or 5xx

        Returns:
            True if status code is not error code