def METHOD_NAME(team):
	stripe = get_stripe()
	subscription_id = frappe.db.get_value(
		"Subscription", {"team": team}, "stripe_subscription_id"
	)
	if subscription_id:
		try:
			stripe.Subscription.delete(subscription_id)
		except Exception:
			log(team, message="cancel_subscription_failed ❌")
			frappe.cache().sadd(failed_subscriptions, subscription_id)