code: func ParseInstanceTag(t string) (*api.Tag, error) {
  	switch chunks := strings.SplitN(t, ":", 2); {
  	case len(chunks) != 2:
  		return nil, fmt.Errorf("%q doesn't look like a tag (a key:value pair)", t)
  	case len(t) > 400:
  		return nil, fmt.Errorf("the tag is too long, should be <=400 chars: %q", t)
  	case !tagKeyRe.MatchString(chunks[0]):
  		return nil, fmt.Errorf("invalid tag key in %q (should match %q)", t, tagKeyReStr)
  	case strings.HasPrefix(chunks[1], " ") || strings.HasSuffix(chunks[1], " "):
  		return nil, fmt.Errorf("invalid tag value in %q (should not start or end with ' ')", t)
  	case !tagValRe.MatchString(chunks[1]):
  		return nil, fmt.Errorf("invalid tag value in %q (should match %q)", t, tagValReStr)
  	default:
  		return &api.Tag{
  			Key:   chunks[0],
  			Value: chunks[1],
  		}, nil
  	}
  }
docs: // ParseInstanceTag takes "k:v" string and returns its proto representation.