Raise appropriate error when bad response received.

def raise_right_error(response):
    """Raise appropriate error when bad response received."""
    if response.status_code == 200:
        return
    if response.status_code == 500:
        raise ServerError('Clef servers are down.')
    if response.status_code == 403:
        message = response.json().get('error')
        error_class = MESSAGE_TO_ERROR_MAP[message]
        if error_class == InvalidOAuthTokenError:
            message = 'Something went wrong at Clef. Unable to retrieve user information with this token.'
        raise error_class(message)
    if response.status_code == 400:
        message = response.json().get('error')
        error_class = MESSAGE_TO_ERROR_MAP[message]
        if error_class:
            raise error_class(message)
        else:
            raise InvalidLogoutTokenError(message)
    if response.status_code == 404:
        raise NotFoundError('Unable to retrieve the page. Are you sure the Clef API endpoint is configured right?')
    raise APIError