def check_metric_content(error_message, name, mp_name, min, max, mp_metric_name=None):
    """Create a callable to verify the content of a metric in a response from the
    krake API.

    To be used with the :meth:`run` function. The callable will raise an
    :class:`AssertionError` if the content of the metric in the response is different
    from the given one.

    Args:
        error_message (str): message that will be displayed if the check fails.
        name (str): expected name of the metric
        mp_name (str): expected name of the metric's metrics provider
        mp_metric_name (str): expected name of the metric's metrics provider's metric
        min (float): expected minimum value of the metric
        max (float): expected maximum value of the metric

    Returns:
        callable: a condition that will check its given response against the parameters
            of the current function.

    Raises:
        AssertionError: if the content of the metric in the response is different
            from the given one.
    """

    if not mp_metric_name:
        mp_metric_name = name

    expected_metric = {
        "api": "core",
        "kind": "GlobalMetric",
        "metadata": {"name": name},
        "spec": {
            "max": float(max),
            "min": float(min),
            "provider": {"metric": mp_metric_name, "name": mp_name},
        },
    }

    def validate(response):
        observed_metric = response.json

        details = (
            f"\nExpected spec: {expected_metric['spec']}.\n"
            f"Observed: {observed_metric['spec']}."
        )
        assert observed_metric["spec"] == expected_metric["spec"], (
            error_message + details
        )

        details = (
            f"\nExpected name: {name}."
            f"\nObserved: {observed_metric['metadata']['name']}."
        )
        assert observed_metric["metadata"]["name"] == name, error_message + details

    return validate