(cls, id, stripe_account=None, **kwargs)
return instance
Retrieve object from the db, if it exists. If it doesn't, query Stripe to fetch
        the object and sync with the db.
Retrieve object from the db, if it exists. If it doesn't, query Stripe to fetch
        the object and sync with the db.
Retrieve object from the db if it exists . If it doesn t query Stripe to fetch the object and sync with the db .
def _get_or_retrieve(cls, id, stripe_account=None, **kwargs):
        """
        Retrieve object from the db, if it exists. If it doesn't, query Stripe to fetch
        the object and sync with the db.
        """
        try:
            return cls.objects.get(id=id)
        except cls.DoesNotExist:
            pass

        if stripe_account:
            kwargs["stripe_account"] = str(stripe_account)

        # If no API key is specified, use the default one for the specified livemode
        # (or if no livemode is specified, the default one altogether)
        kwargs.setdefault(
            "api_key",
            djstripe_settings.get_default_api_key(livemode=kwargs.get("livemode")),
        )
        data = cls.stripe_class.retrieve(id=id, **kwargs)
        instance = cls.sync_from_stripe_data(data)
        return instance
def _get_or_retrieve ( cls , id , stripe_account = None , * * kwargs ) : try : return cls . objects . get ( id = id ) except cls . DoesNotExist : pass if stripe_account : kwargs [ "stripe_account" ] = str ( stripe_account ) # If no API key is specified, use the default one for the specified livemode # (or if no livemode is specified, the default one altogether) kwargs . setdefault ( "api_key" , djstripe_settings . get_default_api_key ( livemode = kwargs . get ( "livemode" ) ) , ) data = cls . stripe_class . retrieve ( id = id , * * kwargs ) instance = cls . sync_from_stripe_data ( data ) return instance