def cancel(self,identity,params=None, headers=None):
path = self._sub_url_params('<STR_LIT>', {<EOL>'<STR_LIT>': identity,<EOL>})<EOL>if params is not None:<EOL><INDENT>params = {'<STR_LIT:data>': params}<EOL><DEDENT>response = self._perform_request('<STR_LIT:POST>', path, params, headers,<EOL>retry_failures=False)<EOL>return self._resource_for(response)<EOL>
Cancel a subscription.

        Immediately cancels a subscription; no more payments will be created
        under it. Any metadata supplied to this endpoint will be stored on the
        payment cancellation event it causes.

        This will fail with a cancellation_failed error if the subscription is
        already cancelled or finished.

        Args:
              identity (string): Unique identifier, beginning with "SB".
              params (dict, optional): Request body.

        Returns:
              ListResponse of Subscription instances