from flask import make_response, jsonify


def create_client_error_response(message: str, status_code=400):

    if status_code < 400 or status_code > 499:
        message = 'The value of status code "{status_code}" is not within range of 400...499.'
        raise ValueError(message)

    response = make_response(jsonify(error=message), status_code)

    return response


def create_not_found_error_response(message: str = "Not Found"):
    response = create_client_error_response(message, 404)

    return response
