def _check_iterative_process_compatibility(iterative_process):
    'Checks the compatibility of an iterative process with the training loop.'
    error_message = 'The iterative_process argument must be of type`tff.templates.IterativeProcess`, and must have an attribute `get_model_weights`, which must be a `tff.Computation`. This computation must accept as input the state of `iterative_process`, and its output must be a nested structure of tensors matching the input shape of `validation_fn`.'
    compatibility_error = IterativeProcessCompatibilityError(error_message)
    if (not isinstance(iterative_process, tff.templates.IterativeProcess)):
        raise compatibility_error
    if (not hasattr(iterative_process, 'get_model_weights')):
        raise compatibility_error
    elif (not callable(iterative_process.get_model_weights)):
        raise compatibility_error
    get_model_weights_fn = iterative_process.get_model_weights
    if (not isinstance(get_model_weights_fn, tff.Computation)):
        raise compatibility_error
    input_type = get_model_weights_fn.type_signature.parameter
    server_state_type = iterative_process.state_type.member
    server_state_type.is_assignable_from(input_type)
Checks the compatibility of an iterative process with the training loop.
def _check_iterative_process_compatibility(iterative_process):
    
    error_message = 'The iterative_process argument must be of type`tff.templates.IterativeProcess`, and must have an attribute `get_model_weights`, which must be a `tff.Computation`. This computation must accept as input the state of `iterative_process`, and its output must be a nested structure of tensors matching the input shape of `validation_fn`.'
    compatibility_error = IterativeProcessCompatibilityError(error_message)
    if (not isinstance(iterative_process, tff.templates.IterativeProcess)):
        raise compatibility_error
    if (not hasattr(iterative_process, 'get_model_weights')):
        raise compatibility_error
    elif (not callable(iterative_process.get_model_weights)):
        raise compatibility_error
    get_model_weights_fn = iterative_process.get_model_weights
    if (not isinstance(get_model_weights_fn, tff.Computation)):
        raise compatibility_error
    input_type = get_model_weights_fn.type_signature.parameter
    server_state_type = iterative_process.state_type.member
    server_state_type.is_assignable_from(input_type)