@staticmethod
def _new_instance(CID_subclass: Type[_CIDSubclass], base: Multibase, version: int, codec: Multicodec, hashfun: Multihash, digest: Union[(bytes, Tuple[(Multihash, bytes)])]) -> _CIDSubclass:
    instance: _CIDSubclass = super().__new__(CID_subclass)
    instance._base = base
    assert (version in (0, 1))
    instance._version = cast(Literal[(0, 1)], version)
    instance._codec = codec
    instance._hashfun = hashfun
    if isinstance(digest, bytes):
        instance._digest = digest
    elif isinstance(digest, byteslike):
        instance._digest = bytes(digest)
    else:
        (_hashfun, raw_digest) = digest
        if (not isinstance(raw_digest, bytes)):
            raw_digest = bytes(raw_digest)
        assert (_hashfun == hashfun), 'You passed different multihashes to a _new_instance call with digest as a pair.'
        instance._digest = hashfun.wrap(raw_digest)
    return instance
@staticmethod
def _new_instance(CID_subclass: Type[_CIDSubclass], base: Multibase, version: int, codec: Multicodec, hashfun: Multihash, digest: Union[(bytes, Tuple[(Multihash, bytes)])]) -> _CIDSubclass:
    instance: _CIDSubclass = super().__new__(CID_subclass)
    instance._base = base
    assert (version in (0, 1))
    instance._version = cast(Literal[(0, 1)], version)
    instance._codec = codec
    instance._hashfun = hashfun
    if isinstance(digest, bytes):
        instance._digest = digest
    elif isinstance(digest, byteslike):
        instance._digest = bytes(digest)
    else:
        (_hashfun, raw_digest) = digest
        if (not isinstance(raw_digest, bytes)):
            raw_digest = bytes(raw_digest)
        assert (_hashfun == hashfun), 'You passed different multihashes to a _new_instance call with digest as a pair.'
        instance._digest = hashfun.wrap(raw_digest)
    return instance