code: async def get_nym_role(self, target_did: str = None) -> Role:
          
  
          LOGGER.debug('BaseAnchor.get_nym_role >>> target_did: %s', target_did)
  
          nym = json.loads(await self.get_nym(target_did))
          if not nym:
              LOGGER.debug('BaseAnchor.get_nym_role <!< Ledger has no cryptonym for anchor %s', self.name)
              raise AbsentNym('Ledger has no cryptonym for anchor {}'.format(self.name))
  
          rv = Role.get(nym['role'])
  
          LOGGER.debug('BaseAnchor.get_nym_role <<< %s', rv)
          return rv
docs: Return the cryptonym role for input did from the ledger - note that this may exceed
          the role of least privilege for the class.
  
          Raise AbsentNym if current anchor has no cryptonym on the ledger, or WalletState if current DID unavailable.
  
          :param target_did: DID of cryptonym role to fetch (default own DID)
          :return: identifier for current cryptonym role on ledger