code: def cancel_subscription(self, idempotency_key=None, **params):
          
          warnings.warn(
              'The `cancel_subscription` method is deprecated. Instead, use the '
              '`subscriptions` resource on the customer object to cancel a '
              'subscription',
              DeprecationWarning)
          url = self.instance_url() + '/subscription'
          headers = populate_headers(idempotency_key)
          d = self.request('delete', url, params, headers)
          d.addCallback(lambda response: self.refresh_from(
              {'subscription': response}, api_key, True))
          return d.addCallback(lambda _: self.subscription)
docs: Return a deferred.