def create_response_error_message(response):
    """Works out what to say about a response that isn't JSON.

    :param response: The HTTP response object.
    :rtype: ``str``"""

    content_type = response.headers["Content-type"]
    try:
        content = response.content.decode()
    except: content = None
    message = f"Server did not return JSON, it returned {content_type}"
    if content and len(content) < 256:
        message += ":\n" + content
    return message