async def send_cred_def(self, s_id: str, revocation: bool = True, rr_size: int = None) -> str:
LOGGER.debug('<STR_LIT>', s_id, revocation, rr_size)<EOL>rv_json = json.dumps({})<EOL>schema_json = await self.get_schema(schema_key(s_id))<EOL>schema = json.loads(schema_json)<EOL>cd_id = cred_def_id(self.did, schema['<STR_LIT>'])<EOL>private_key_ok = True<EOL>with CRED_DEF_CACHE.lock:<EOL><INDENT>try:<EOL><INDENT>rv_json = await self.get_cred_def(cd_id)<EOL>LOGGER.info(<EOL>'<STR_LIT>',<EOL>schema['<STR_LIT:name>'],<EOL>schema['<STR_LIT:version>'],<EOL>self.wallet.name)<EOL><DEDENT>except AbsentCredDef:<EOL><INDENT>pass  <EOL><DEDENT>try:<EOL><INDENT>(_, cred_def_json) = await anoncreds.issuer_create_and_store_credential_def(<EOL>self.wallet.handle,<EOL>self.did,  <EOL>schema_json,<EOL>CD_ID_TAG,  <EOL>'<STR_LIT>',<EOL>json.dumps({'<STR_LIT>': revocation}))<EOL>if json.loads(rv_json):<EOL><INDENT>private_key_ok = False<EOL>LOGGER.warning(<EOL>'<STR_LIT>', cd_id)<EOL><DEDENT><DEDENT>except IndyError as x_indy:<EOL><INDENT>if x_indy.error_code == ErrorCode.AnoncredsCredDefAlreadyExistsError:<EOL><INDENT>if json.loads(rv_json):<EOL><INDENT>LOGGER.info(<EOL>'<STR_LIT>',<EOL>self.wallet.name,<EOL>schema['<STR_LIT:name>'],<EOL>schema['<STR_LIT:version>'])<EOL><DEDENT>else:<EOL><INDENT>LOGGER.debug('<STR_LIT>', self.wallet.name)<EOL>raise CorruptWallet(<EOL>'<STR_LIT>'.format(<EOL>self.wallet.name,<EOL>schema['<STR_LIT:name>'],<EOL>schema['<STR_LIT:version>']))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>LOGGER.debug(<EOL>'<STR_LIT>',<EOL>self.wallet.name,<EOL>x_indy.error_code)<EOL>raise<EOL><DEDENT><DEDENT>if not json.loads(rv_json):  <EOL><INDENT>req_json = await ledger.build_cred_def_request(self.did, cred_def_json)<EOL>await self._sign_submit(req_json)<EOL>rv_json = await self.get_cred_def(cd_id)  <EOL>if revocation:<EOL><INDENT>await self._sync_revoc(rev_reg_id(cd_id, <NUM_LIT:0>), rr_size)  <EOL><DEDENT><DEDENT><DEDENT>if revocation and private_key_ok:<EOL><INDENT>for tag in [str(t) for t in range(int(Tails.next_tag(self._dir_tails, cd_id)[<NUM_LIT:0>]))]:  <EOL><INDENT>await self._sync_revoc(rev_reg_id(cd_id, tag), rr_size if tag == <NUM_LIT:0> else None)<EOL><DEDENT><DEDENT>dir_cred_def = join(self._dir_tails, cd_id)<EOL>if not isdir(dir_cred_def):  <EOL><INDENT>makedirs(dir_cred_def, exist_ok=True)<EOL><DEDENT>LOGGER.debug('<STR_LIT>', rv_json)<EOL>return rv_json<EOL>
Create a credential definition as Issuer, store it in its wallet, and send it to the ledger.

Raise CorruptWallet for wallet not pertaining to current ledger, BadLedgerTxn on failure
to send credential definition to ledger if need be, or IndyError for any other failure
to create and store credential definition in wallet.

:param s_id: schema identifier
:param revocation: whether to support revocation for cred def
:param rr_size: size of initial revocation registry (default as per _create_rev_reg()), if revocation supported
:return: json credential definition as it appears on ledger