def prepare_for_cancel(  # type: ignore[no-untyped-def]
        self, cancellation_date=timezone.now(), update_chargebee=True
    ) -> None:
        """
        This method gets a subscription ready for cancellation.

        If cancellation_date is in the future some aspects are
        reserved for a task after the date has passed.
        """
        # Avoid circular import.
        from organisations.tasks import send_org_subscription_cancelled_alert

        if self.payment_method == CHARGEBEE and update_chargebee:
            cancel_chargebee_subscription(self.subscription_id)  # type: ignore[arg-type]

        send_org_subscription_cancelled_alert.delay(
            kwargs={
                "organisation_name": self.organisation.name,
                "formatted_cancellation_date": cancellation_date.strftime(
                    "%Y-%m-%d %H:%M:%S"
                ),
            }
        )

        if cancellation_date <= timezone.now():
            # Since the date is immediate, wipe data right away.
            self.organisation.cancel_users()  # type: ignore[no-untyped-call]
            self.save_as_free_subscription()  # type: ignore[no-untyped-call]
            return

        # Since the date is in the future, a task takes it.
        self.cancellation_date = cancellation_date
        self.billing_status = None
        self.save()

        This method gets a subscription ready for cancellation.

        If cancellation_date is in the future some aspects are
        reserved for a task after the date has passed.
        
api/organisations/models.py