def set(self, *, base: Union[(None, str, Multibase)]=None, version: Union[(None, int)]=None, codec: Union[(None, str, int, Multicodec)]=None) -> 'CID':
    '\n            Returns a new CID obtained by setting new values for one or more of:\n            ``base``, ``version``, or ``codec``.\n\n            Example usage:\n\n            >>> s = "zb2rhe5P4gXftAwvA4eXQ5HJwsER2owDyS9sKaQRRVQPn93bA"\n            >>> cid = CID.decode(s)\n            >>> cid\n            CID(\'base58btc\', 1, \'raw\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(base="base32")\n            CID(\'base32\', 1, \'raw\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(codec="dag-cbor")\n            CID(\'base58btc\', 1, \'dag-cbor\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(version=0, codec="dag-pb")\n            CID(\'base58btc\', 0, \'dag-pb\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid\n            CID(\'base58btc\', 1, \'raw\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            # Note: \'CID.set\' returns new instances,\n            #       the original \'cid\' instance is unchanged\n\n            If setting ``version`` to 0, ``base`` must be \'base58btc\' and ``codec`` must be \'dag-pb\'.\n\n            >>> s = "zb2rhe5P4gXftAwvA4eXQ5HJwsER2owDyS9sKaQRRVQPn93bA"\n            >>> cid = CID.decode(s)\n            >>> cid\n            CID(\'base58btc\', 1, \'raw\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(version=0, codec="dag-pb")\n            CID(\'base58btc\', 0, \'dag-pb\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(version=0)\n            ValueError: CIDv0 multicodec must be \'dag-pb\', found \'raw\' instead.\n            >>> cid.set(version=0, codec="dag-pb", base="base32")\n            ValueError: CIDv0 multibase must be \'base58btc\', found \'base32\' instead\n\n            :param base: the new CID multibase, or :obj:`None` if multibase unchanged\n            :type base: :obj:`None`, :obj:`str` or :class:`~multiformats.multibase.Multibase`, *optional*\n            :param version: the new CID version, or :obj:`None` if version unchanged\n            :type version: :obj:`None`, 0 or 1, *optional*\n            :param codec: the new content multicodec, or :obj:`None` if multicodec unchanged\n            :type codec: :obj:`None`, :obj:`str` or :class:`~multiformats.multicodec.Multicodec`, *optional*\n\n            :raises KeyError: if the multibase or multicodec are unknown\n\n        '
    hashfun = self.hashfun
    digest = self.digest
    if ((base is not None) and (base not in (self.base, self.base.name))):
        base = _CID_validate_multibase(base)
    else:
        base = self.base
    if ((codec is not None) and (codec not in (self.codec, self.codec.name, self.codec.code))):
        codec = _CID_validate_multicodec(codec)
    else:
        codec = self.codec
    if ((version is not None) and (version != self.version)):
        _CID_validate_version(version, base, codec, hashfun)
    else:
        version = self.version
    return CID._new_instance(CID, base, version, codec, hashfun, digest)
Returns a new CID obtained by setting new values for one or more of:
``base``, ``version``, or ``codec``.

Example usage:

>>> s = "zb2rhe5P4gXftAwvA4eXQ5HJwsER2owDyS9sKaQRRVQPn93bA"
>>> cid = CID.decode(s)
>>> cid
CID('base58btc', 1, 'raw',
'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95')
>>> cid.set(base="base32")
CID('base32', 1, 'raw',
'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95')
>>> cid.set(codec="dag-cbor")
CID('base58btc', 1, 'dag-cbor',
'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95')
>>> cid.set(version=0, codec="dag-pb")
CID('base58btc', 0, 'dag-pb',
'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95')
>>> cid
CID('base58btc', 1, 'raw',
'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95')
# Note: 'CID.set' returns new instances,
#       the original 'cid' instance is unchanged

If setting ``version`` to 0, ``base`` must be 'base58btc' and ``codec`` must be 'dag-pb'.

>>> s = "zb2rhe5P4gXftAwvA4eXQ5HJwsER2owDyS9sKaQRRVQPn93bA"
>>> cid = CID.decode(s)
>>> cid
CID('base58btc', 1, 'raw',
'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95')
>>> cid.set(version=0, codec="dag-pb")
CID('base58btc', 0, 'dag-pb',
'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95')
>>> cid.set(version=0)
ValueError: CIDv0 multicodec must be 'dag-pb', found 'raw' instead.
>>> cid.set(version=0, codec="dag-pb", base="base32")
ValueError: CIDv0 multibase must be 'base58btc', found 'base32' instead

:param base: the new CID multibase, or :obj:`None` if multibase unchanged
:type base: :obj:`None`, :obj:`str` or :class:`~multiformats.multibase.Multibase`, *optional*
:param version: the new CID version, or :obj:`None` if version unchanged
:type version: :obj:`None`, 0 or 1, *optional*
:param codec: the new content multicodec, or :obj:`None` if multicodec unchanged
:type codec: :obj:`None`, :obj:`str` or :class:`~multiformats.multicodec.Multicodec`, *optional*

:raises KeyError: if the multibase or multicodec are unknown
def set(self, *, base: Union[(None, str, Multibase)]=None, version: Union[(None, int)]=None, codec: Union[(None, str, int, Multicodec)]=None) -> 'CID':
    '\n            Returns a new CID obtained by setting new values for one or more of:\n            ``base``, ``version``, or ``codec``.\n\n            Example usage:\n\n            >>> s = "zb2rhe5P4gXftAwvA4eXQ5HJwsER2owDyS9sKaQRRVQPn93bA"\n            >>> cid = CID.decode(s)\n            >>> cid\n            CID(\'base58btc\', 1, \'raw\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(base="base32")\n            CID(\'base32\', 1, \'raw\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(codec="dag-cbor")\n            CID(\'base58btc\', 1, \'dag-cbor\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(version=0, codec="dag-pb")\n            CID(\'base58btc\', 0, \'dag-pb\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid\n            CID(\'base58btc\', 1, \'raw\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            # Note: \'CID.set\' returns new instances,\n            #       the original \'cid\' instance is unchanged\n\n            If setting ``version`` to 0, ``base`` must be \'base58btc\' and ``codec`` must be \'dag-pb\'.\n\n            >>> s = "zb2rhe5P4gXftAwvA4eXQ5HJwsER2owDyS9sKaQRRVQPn93bA"\n            >>> cid = CID.decode(s)\n            >>> cid\n            CID(\'base58btc\', 1, \'raw\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(version=0, codec="dag-pb")\n            CID(\'base58btc\', 0, \'dag-pb\',\n            \'12206e6ff7950a36187a801613426e858dce686cd7d7e3c0fc42ee0330072d245c95\')\n            >>> cid.set(version=0)\n            ValueError: CIDv0 multicodec must be \'dag-pb\', found \'raw\' instead.\n            >>> cid.set(version=0, codec="dag-pb", base="base32")\n            ValueError: CIDv0 multibase must be \'base58btc\', found \'base32\' instead\n\n            :param base: the new CID multibase, or :obj:`None` if multibase unchanged\n            :type base: :obj:`None`, :obj:`str` or :class:`~multiformats.multibase.Multibase`, *optional*\n            :param version: the new CID version, or :obj:`None` if version unchanged\n            :type version: :obj:`None`, 0 or 1, *optional*\n            :param codec: the new content multicodec, or :obj:`None` if multicodec unchanged\n            :type codec: :obj:`None`, :obj:`str` or :class:`~multiformats.multicodec.Multicodec`, *optional*\n\n            :raises KeyError: if the multibase or multicodec are unknown\n\n        '
    hashfun = self.hashfun
    digest = self.digest
    if ((base is not None) and (base not in (self.base, self.base.name))):
        base = _CID_validate_multibase(base)
    else:
        base = self.base
    if ((codec is not None) and (codec not in (self.codec, self.codec.name, self.codec.code))):
        codec = _CID_validate_multicodec(codec)
    else:
        codec = self.codec
    if ((version is not None) and (version != self.version)):
        _CID_validate_version(version, base, codec, hashfun)
    else:
        version = self.version
    return CID._new_instance(CID, base, version, codec, hashfun, digest)