def delete_context(
    base_type: Type[T], httpreq: Request, id: str, request: DeleteContextRequest
) -> T:
    """Deletes context from an arbitrary Yeti Object."""
    obj = base_type.get(id)
    if not obj:
        raise HTTPException(
            status_code=404, detail=f"{base_type.__name__} {id} not found"
        )

    old_context = obj.context.copy()
    refreshed_obj = obj.delete_context(request.source, request.context)
    obj.context = old_context
    audit.log_timeline(httpreq.state.username, refreshed_obj, old=obj)
    return refreshed_obj
Deletes context from an arbitrary Yeti Object.
core/web/apiv2/context.py