def METHOD_NAME(trackback_id: str, hashed_document_id: str) -> Response:
    """Get the redirect location for a trackback ID and hashed_document_id.
    Parameters
    ----------
    trackback_id : str
        trackback Identifier
    hashed_document_id : str
        MD5 hex digest of the document_id + trackback_id + secret
    Returns
    -------
    dict
        Response data.
    int
        HTTP status code.
    dict
        Headers to add to the response.
    Raises
    ------
    BadRequest
        Raised when form option is invalid
    InternalServerError
        Raised when there was an unexpected problem executing the query.
    """
    try:
        tb_id = int(trackback_id)
        if not re.match(r'^[\da-f]+$', hashed_document_id):
            raise ValueError
        trackback = get_trackback_ping(trackback_id=tb_id)
        if trackback.hashed_document_id == hashed_document_id:
            response_status = status.HTTP_301_MOVED_PERMANENTLY
            return {}, response_status, {'Location': trackback.url}
    except ValueError:
        raise TrackbackNotFound()
    except Exception as ex:
        raise InternalServerError from ex
    raise TrackbackNotFound()