def normalize_response(response):
    """ Normalize the given response, by always returning a 3-element tuple
    (status, headers, body). The body is not "resolved"; it is safe
    to call this function multiple times on the same response.
    """
    if isinstance(response, tuple):
        if len(response) == 3:
            status, headers, body = response
        elif len(response) == 2:
            status = 200
            headers, body = response
        elif len(response) == 1:
            status, headers, body = 200, {}, response[0]
        else:
            raise ValueError(f'Handler returned {len(response)}-tuple.')
    else:
        status, headers, body = 200, {}, response
    if not isinstance(status, int):
        raise ValueError(f'Status code must be an int, not {type(status)}')
    if not isinstance(headers, dict):
        raise ValueError(f'Headers must be a dict, not {type(headers)}')
    return status, headers, body
