code: func New(mac string) (*MagicPacket, error) {
  	var packet MagicPacket
  	var macAddr MACAddress
  
  	hwAddr, err := net.ParseMAC(mac)
  	if err != nil {
  		return nil, err
  	}
  
  	// We only support 6 byte MAC addresses since it is much harder to use the
  	// binary.Write(...) interface when the size of the MagicPacket is dynamic.
  	if !reMAC.MatchString(mac) {
  		return nil, fmt.Errorf("%s is not a IEEE 802 MAC-48 address", mac)
  	}
  
  	// Copy bytes from the returned HardwareAddr -> a fixed size MACAddress.
  	for idx := range macAddr {
  		macAddr[idx] = hwAddr[idx]
  	}
  
  	// Setup the header which is 6 repetitions of 0xFF.
  	for idx := range packet.header {
  		packet.header[idx] = 0xFF
  	}
  
  	// Setup the payload which is 16 repetitions of the MAC addr.
  	for idx := range packet.payload {
  		packet.payload[idx] = macAddr
  	}
  
  	return &packet, nil
  }
docs: // New returns a magic packet based on a mac address string.