<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def get_nym_role(self, target_did: str = None) -> Role: """ 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 """


        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