code: def build_encryption_materials_cache_key(partition, request):
      
      if request.algorithm is None:
          _algorithm_info = b"\x00"
      else:
          _algorithm_info = b"\x01" + request.algorithm.id_as_bytes()
  
      hasher = _new_cache_key_hasher()
      _partition_hash = _partition_name_hash(hasher=hasher.copy(), partition_name=partition)
      _ec_hash = _encryption_context_hash(hasher=hasher.copy(), encryption_context=request.encryption_context)
  
      hasher.update(_partition_hash)
      hasher.update(_algorithm_info)
      hasher.update(_ec_hash)
      return hasher.finalize()
docs: Generates a cache key for an encrypt request.
  
      :param bytes partition: Partition name for which to generate key
      :param request: Request for which to generate key
      :type request: aws_encryption_sdk.materials_managers.EncryptionMaterialsRequest
      :returns: cache key
      :rtype: bytes