code: def detached_signature_for(plaintext_str, keys):
      
      ctx = gpg.core.Context(armor=True)
      ctx.signers = keys
      (sigblob, sign_result) = ctx.sign(plaintext_str,
                                        mode=gpg.constants.SIG_MODE_DETACH)
      return sign_result.signatures, sigblob
docs: Signs the given plaintext string and returns the detached signature.
  
      A detached signature in GPG speak is a separate blob of data containing
      a signature for the specified plaintext.
  
      :param bytes plaintext_str: bytestring to sign
      :param keys: list of one or more key to sign with.
      :type keys: list[gpg.gpgme._gpgme_key]
      :returns: A list of signature and the signed blob of data
      :rtype: tuple[list[gpg.results.NewSignature], str]