code: async def get_nym(self, target_did: str = None) -> str:
          
  
          LOGGER.debug('BaseAnchor.get_nym >>> target_did: %s', target_did)
  
          if target_did and not ok_did(target_did):
              LOGGER.debug('BaseAnchor.get_nym <!< Bad DID %s', target_did)
              raise BadIdentifier('Bad DID {}'.format(target_did))
  
          if not (target_did or self.did):
              LOGGER.debug('BaseAnchor.get_nym <!< Bad wallet state: DID for %s unavailable', self.name)
              raise WalletState('Bad wallet state: DID for {} unavailable'.format(self.name))
  
          rv = json.dumps({})
          get_nym_req = await ledger.build_get_nym_request(self.did, target_did or self.did)
          resp_json = await self._submit(get_nym_req)
  
          data_json = (json.loads(resp_json))['result']['data']  # it's double-encoded on the ledger
          if data_json:
              rv = data_json
  
          LOGGER.debug('BaseAnchor.get_nym <<< %s', rv)
          return rv
docs: Get json cryptonym (including current verification key) for input (anchor) DID from ledger.
          Return empty production {} if the ledger has no such cryptonym.
  
          Raise BadLedgerTxn on failure. Raise WalletState if target DID is default (own DID) value but
          wallet does not have it (neither created nor opened since initialization).
  
          :param target_did: DID of cryptonym to fetch (default own DID)
          :return: cryptonym json