(
        cls,
        subscriber,
        livemode=djstripe_settings.STRIPE_LIVE_MODE,
        stripe_account=None,
    )
Get or create a dj-stripe customer.

        :param subscriber: The subscriber model instance for which to get or
            create a customer.
        :type subscriber: User

        :param livemode: Whether to get the subscriber in live or test mode.
        :type livemode: bool
Get or create a dj-stripe customer.
Get or create a dj - stripe customer .
def get_or_create(
        cls,
        subscriber,
        livemode=djstripe_settings.STRIPE_LIVE_MODE,
        stripe_account=None,
    ):
        """
        Get or create a dj-stripe customer.

        :param subscriber: The subscriber model instance for which to get or
            create a customer.
        :type subscriber: User

        :param livemode: Whether to get the subscriber in live or test mode.
        :type livemode: bool
        """

        try:
            return Customer.objects.get(subscriber=subscriber, livemode=livemode), False
        except Customer.DoesNotExist:
            action = "create:{}".format(subscriber.pk)
            idempotency_key = djstripe_settings.get_idempotency_key(
                "customer", action, livemode
            )
            return (
                cls.create(
                    subscriber,
                    idempotency_key=idempotency_key,
                    stripe_account=stripe_account,
                ),
                True,
            )
def get_or_create ( cls , subscriber , livemode = djstripe_settings . STRIPE_LIVE_MODE , stripe_account = None , ) : try : return Customer . objects . get ( subscriber = subscriber , livemode = livemode ) , False except Customer . DoesNotExist : action = "create:{}" . format ( subscriber . pk ) idempotency_key = djstripe_settings . get_idempotency_key ( "customer" , action , livemode ) return ( cls . create ( subscriber , idempotency_key = idempotency_key , stripe_account = stripe_account , ) , True , )