def METHOD_NAME(
    context: Context, data_dict: Optional[DataDict] = None
) -> Activity:
    try:
        return context["activity"]
    except KeyError:
        if not data_dict:
            data_dict = {}
        id = data_dict.get("id", None)
        if not id:
            raise tk.ValidationError(
                {"message": "Missing id, can not get Activity object"}
            )
        obj = Activity.get(id)
        if not obj:
            raise tk.ObjectNotFound()
        # Save in case we need this again during the request
        context["activity"] = obj
        return obj