You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: deployment.go
    path of file: ./repos/gardener/pkg/utils/kubernetes/health
    
    the code of the file until where you have to start completion: // Copyright 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache So
    
func IsDeploymentUpdated(reader client.Reader, deployment *appsv1.Deployment) func(context.Context) (bool, error) {
	return func(ctx context.Context) (bool, error) {
		if err := reader.Get(ctx, client.ObjectKeyFromObject(deployment), deployment); err != nil {
			return retry.SevereError(err)
		}

		// Check if Deployment is still progressing.
		if progressing, reason := IsDeploymentProgressing(deployment); progressing {
			return retry.MinorError(errors.New(reason))
		}

		// If Deployment is no longer progressing then check if it is healthy.
		if err := CheckDeployment(deployment); err != nil {
			return retry.MinorError(err)
		}

		// Now there might be still pods in the system belonging to an older ReplicaSet of the Deployment.
		exactNumberOfPods, err := DeploymentHasExactNumberOfPods(ctx, reader, deployment)
		if err != nil {
			return retry.SevereError(err)
		}
		if !exactNumberOfPods {
			return retry.MinorError(errors.New("there are still non-terminated old pods"))
		}

		return retry.Ok()
	}
}