def METHOD_NAME(
    self,
    group: Group,
    type: ActivityType,
    user: Optional[User | RpcUser] = None,
    user_id: Optional[int] = None,
    data: Optional[Mapping[str, Any]] = None,
    send_notification: bool = True,
) -> Activity:
    if user:
        user_id = user.id
    activity_args = {
        "project_id": group.project_id,
        "group": group,
        "type": type.value,
        "data": data,
    }
    if user_id is not None:
        activity_args["user_id"] = user_id
    activity = self.create(**activity_args)
    if send_notification:
        activity.send_notification()
    return activity