def _CID_validate_version(version: int, base: Multibase, codec: Multicodec, hashfun: Multihash) -> int:
    if (version in (2, 3)):
        raise ValueError('CID versions 2 and 3 are reserved for future use.')
    if (version not in (0, 1)):
        raise ValueError(f'CID version {version} is not allowed.')
    if (version == 0):
        if (base.name != 'base58btc'):
            raise ValueError(f"CIDv0 multibase must be 'base58btc', found {repr(base.name)} instead.")
        if (codec.name != 'dag-pb'):
            raise ValueError(f"CIDv0 multicodec must be 'dag-pb', found {repr(codec.name)} instead.")
        if (hashfun.name != 'sha2-256'):
            raise ValueError(f"CIDv0 multihash must be 'sha2-256', found {repr(hashfun.name)} instead.")
    return version
def _CID_validate_version(version: int, base: Multibase, codec: Multicodec, hashfun: Multihash) -> int:
    if (version in (2, 3)):
        raise ValueError('CID versions 2 and 3 are reserved for future use.')
    if (version not in (0, 1)):
        raise ValueError(f'CID version {version} is not allowed.')
    if (version == 0):
        if (base.name != 'base58btc'):
            raise ValueError(f"CIDv0 multibase must be 'base58btc', found {repr(base.name)} instead.")
        if (codec.name != 'dag-pb'):
            raise ValueError(f"CIDv0 multicodec must be 'dag-pb', found {repr(codec.name)} instead.")
        if (hashfun.name != 'sha2-256'):
            raise ValueError(f"CIDv0 multihash must be 'sha2-256', found {repr(hashfun.name)} instead.")
    return version