def METHOD_NAME(response):
    """Formats an Elastic search endpoint response."""
    formatted = {
        "error": False,
        "results": []
    }
    if "error" in response:
        formatted["error"] = True
        return formatted
    body = json.loads(response.text)
    engine = body.get("meta").get("engine").get("name")
    results = body.get("results")
    if engine == "tcf-courses":
        formatted["results"] = format_courses(results)
    elif engine == "tcf-instructors":
        formatted["results"] = format_instructors(results)
    else:
        formatted["error"] = True
        formatted["message"] = "Unknown engine, please verify engine exists"
    return formatted