code: def sign(self, identity, digest):
          
          log.info('please confirm GPG signature on %s for "%s"...',
                   self.device, identity.to_string())
          if identity.curve_name == formats.CURVE_NIST256:
              digest = digest[:32]  # sign the first 256 bits
          log.debug('signing digest: %s', util.hexlify(digest))
          with self.device:
              sig = self.device.sign(blob=digest, identity=identity)
          return (util.bytes2num(sig[:32]), util.bytes2num(sig[32:]))
docs: Sign the digest and return a serialized signature.