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: json.go
    path of file: ./repos/grafana/pkg/util
    
    the code of the file until where you have to start completion: package util

import (
	"encoding/json"

	"github.com/jmespath/go-jmespath"

	"github.com/grafana/grafana/pkg/util/errutil"
)

// DynMap defines a dynamic map interface.
type DynMap map[string]any

var (
	// ErrEmptyJSON is an error for empty attribute in JSON.
	ErrEmptyJSON = errutil.NewBase(errutil.StatusBadRequest,
		"json-missing-body", errutil.WithPublicMessage("Empty JSON provided"))

	// ErrNoAttributePathSpecified is an error for no attribute path specified.
	ErrNoAttributePathSpecified = errutil.NewBase(errutil.StatusBadRequest,
		"json-no-attribute-path-specified", errutil.WithPublicMessage("No attribute path specified"))

	// ErrFailedToUnmarshalJSON is an error for failure in unmarshalling JSON.
	ErrFailedToUnmarshalJSON = errutil.NewBase(errutil.StatusBadRequest,
		"json-failed-to-unmarshal", errutil.WithPublicMessage("Failed to unmarshal JSON"))

	// ErrFailedToSearchJSON is an error for failure in searching JSON.
	ErrFailedToSearchJSON = errutil.NewBase(errutil.StatusBadRequest,
		"json-failed-to-search", errutil.WithPublicMe
    
func searchJSONForAttr(attributePath string, data any) (any, error) {
	// If no attribute path is specified, return an error
	if attributePath == "" {
		return "", ErrNoAttributePathSpecified.Errorf("attribute path: %q", attributePath)
	}

	// If the data is nil, return an error
	if data == nil {
		return "", ErrEmptyJSON.Errorf("empty json, attribute path: %q", attributePath)
	}

	// Copy the data to a new variable
	var jsonData = data

	// If the data is a byte slice, try to unmarshal it into a JSON object
	if dataBytes, ok := data.([]byte); ok {
		// If the byte slice is empty, return an error
		if len(dataBytes) == 0 {
			return "", ErrEmptyJSON.Errorf("empty json, attribute path: %q", attributePath)
		}

		// Try to unmarshal the byte slice
		if err := json.Unmarshal(dataBytes, &jsonData); err != nil {
			return "", ErrFailedToUnmarshalJSON.Errorf("%v: %w", "failed to unmarshal user info JSON response", err)
		}
	}

	// Search for the attribute in the JSON object
	value, err := jmespath.Search(attributePath, jsonData)
	if err != nil {
		return "", ErrFailedToSearchJSON.Errorf("failed to search user info JSON response with provided path: %q: %w", attributePath, err)
	}

	// Return the value and nil error
	return value, nil
}