func (i *IE) STAG() (*STAGFields, error) {
	switch i.Type {
	case STAG:
		fields, err := ParseSTAGFields(i.Payload)
		if err != nil {
			return nil, err
		}
		return fields, nil
	case PDI:
		ies, err := i.PDI()
		if err != nil {
			return nil, err
		}
		for _, x := range ies {
			if x.Type == EthernetPacketFilter {
				return x.STAG()
			}
		}
		return nil, ErrIENotFound
	case EthernetPacketFilter:
		ies, err := i.EthernetPacketFilter()
		if err != nil {
			return nil, err
		}
		for _, x := range ies {
			if x.Type == STAG {
				return x.STAG()
			}
		}
		return nil, ErrIENotFound
	case MACAddressesDetected:
		x, err := i.MACAddressesDetected()
		if err != nil {
			return nil, err
		}
		return ParseSTAGFields(x.STAG)
	case MACAddressesRemoved:
		x, err := i.MACAddressesRemoved()
		if err != nil {
			return nil, err
		}
		return ParseSTAGFields(x.STAG)
	case EthernetContextInformation:
		ies, err := i.EthernetContextInformation()
		if err != nil {
			return nil, err
		}
		for _, x := range ies {
			if x.Type == MACAddressesDetected {
				return x.STAG()
			}
		}
		return nil, ErrIENotFound
	default:
		return nil, &InvalidTypeError{Type: i.Type}
	}
}
STAG returns STAG in structured format if the type of IE matches.
package ie
import (
	"encoding/binary"
	"io"
)
func NewSTAG(flags, pcp, deiFlag uint8, cvid uint16) *IE {
	fields := NewSTAGFields(flags, pcp, deiFlag, cvid)
	b, err := fields.Marshal()
	if err != nil {
		return nil
	}
	return New(STAG, b)
}