code: def delete_attachment(self, attachment, headers=None):
          
          # need latest rev
          self.fetch()
          attachment_url = '/'.join((self.document_url, attachment))
          if headers is None:
              headers = {'If-Match': self['_rev']}
          else:
              headers['If-Match'] = self['_rev']
  
          resp = self.r_session.delete(
              attachment_url,
              headers=headers
          )
          resp.raise_for_status()
          super(Document, self).__setitem__('_rev', response_to_json_dict(resp)['rev'])
          # Execute logic only if attachment metadata exists locally
          if self.get('_attachments'):
              # Remove the attachment metadata for the specified attachment
              if self['_attachments'].get(attachment):
                  self['_attachments'].__delitem__(attachment)
              # Remove empty attachment metadata from the local dictionary
              if not self['_attachments']:
                  super(Document, self).__delitem__('_attachments')
  
          return response_to_json_dict(resp)
docs: Removes an attachment from a remote document and refreshes the locally
          cached document object.
  
          :param str attachment: Attachment file name used to identify the
              attachment.
          :param dict headers: Optional, additional headers to be sent
              with request.
  
          :returns: Attachment deletion status in JSON format