def ok_cred_def_id(token: str, issuer_did: str = None) -> bool:
    """
    Whether input token looks like a valid credential definition identifier from input issuer DID (default any); i.e.,
    <issuer-did>:3:CL:<schema-seq-no>:<cred-def-id-tag> for protocol >= 1.4, or
    <issuer-did>:3:CL:<schema-seq-no> for protocol == 1.3.

    :param token: candidate string
    :param issuer_did: issuer DID to match, if specified
    :return: whether input token looks like a valid credential definition identifier
    """

    cd_id_m = re.match('([{}]{{21,22}}):3:CL:[1-9][0-9]*(:.+)?$'.format(B58), token or '')
    return bool(cd_id_m) and ((not issuer_did) or cd_id_m.group(1) == issuer_did)