code: def sign(self, msg, key):
          
          hasher = hashes.Hash(self.hash_algorithm(), backend=default_backend())
          hasher.update(msg)
          digest = hasher.finalize()
          sig = key.sign(
              digest,
              padding.PSS(
                  mgf=padding.MGF1(self.hash_algorithm()),
                  salt_length=padding.PSS.MAX_LENGTH),
              utils.Prehashed(self.hash_algorithm()))
          return sig
docs: Create a signature over a message
  
          :param msg: The message
          :param key: The key
          :return: A signature