code: def sign(filename):
      
  
      if gnupg is None:
          return
  
      gpg = gnupg.GPG()
  
      with open(filename, "rb") as signfile:
          keyid = fingerprint2keyid(config["gpg_key_fingerprint"])
  
          if keyid is None:
              msg = "No private key for GPG fingerprint '{}'."
              raise ValueError(msg.format(config["gpg_key_fingerprint"]))
  
          signed_data = gpg.sign_file(signfile, keyid=keyid, detach=True)
  
      return signed_data
docs: Returns detached signature for file