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: cleanup.go
    path of file: ./repos/moby/vendor/gotest.tools/v3/internal/cleanup
    
    the code of the file until where you have to start completion: /*
Package cleanup handles migration to and support for the Go 1.14+
testing.TB.Cleanup() function.
*/
package cleanup

import (
	"os"
	"strings"
)

type cleanupT interface {
	Cleanup(f func())
}

// implemented by gotest.tools/x/subte
    
func Cleanup(t logT, f func()) {
	if ht, ok := t.(helperT); ok {
		ht.Helper()
	}
	if noCleanup {
		t.Log("skipping cleanup because TEST_NOCLEANUP was enabled.")
		return
	}
	if ct, ok := t.(cleanupT); ok {
		ct.Cleanup(f)
		return
	}
	if tc, ok := t.(addCleanupT); ok {
		tc.AddCleanup(f)
	}
}