code: async def replace_local_did_metadata(self, loc_did: str, metadata: dict) -> DIDInfo:
          
  
          LOGGER.debug('Wallet.replace_local_did_metadata >>> loc_did: %s, metadata: %s', loc_did, metadata)
  
          old = await self.get_local_did(loc_did)  # raises exceptions if applicable
          now = int(time())
          loc_did_metadata = {**(metadata or {}), 'since': (old.metadata or {}).get('since', now), 'modified': now}
          try:
              await did.set_did_metadata(self.handle, loc_did, json.dumps(loc_did_metadata))
          except IndyError as x_indy:
              LOGGER.debug('Wallet.replace_local_did_metadata <!< indy-sdk raised error %s', x_indy.error_code)
              raise
  
          rv = await self.get_local_did(loc_did)
          LOGGER.debug('Wallet.replace_local_did_metadata <<< %s', rv)
          return rv
docs: Replace the metadata associated with a local DID.
  
          Raise WalletState if wallet is closed, AbsentRecord for no such local DID.
  
          :param loc_did: local DID of interest
          :param metadata: new metadata to store
          :return: DIDInfo for local DID after write