code: func FindIcon(X *xgbutil.XUtil, wid xproto.Window,
  	width, height int) (*Image, error) {
  
  	var ewmhErr, icccmErr error
  
  	// First try to get a EWMH style icon.
  	icon, ewmhErr := findIconEwmh(X, wid, width, height)
  	if ewmhErr != nil { // now look for an icccm-style icon
  		icon, icccmErr = findIconIcccm(X, wid)
  		if icccmErr != nil {
  			return nil, fmt.Errorf("Neither a EWMH-style or ICCCM-style icon "+
  				"could be found for window id %x because: %s *AND* %s",
  				wid, ewmhErr, icccmErr)
  		}
  	}
  
  	// We should have a valid xgraphics.Image if we're here.
  	// If the size doesn't match what's preferred, scale it.
  	if width != 0 && height != 0 {
  		if icon.Bounds().Dx() != width || icon.Bounds().Dy() != height {
  			icon = icon.Scale(width, height)
  		}
  	}
  	return icon, nil
  }
docs: // FindIcon takes a window id and attempts to return an xgraphics.Image of
  // that window's icon.
  // It will first try to look for an icon in _NET_WM_ICON that is closest to
  // the size specified.
  // If there are no icons in _NET_WM_ICON, then WM_HINTS will be checked for
  // an icon.
  // If an icon is found from either one and doesn't match the size
  // specified, it will be scaled to that size.
  // If the width and height are 0, then the largest icon will be returned with
  // no scaling.
  // If an icon is not found, an error is returned.