code: func ParseData(data []byte) (*Profile, error) {
  	var p *Profile
  	var err error
  	if len(data) >= 2 && data[0] == 0x1f && data[1] == 0x8b {
  		gz, err := gzip.NewReader(bytes.NewBuffer(data))
  		if err == nil {
  			data, err = ioutil.ReadAll(gz)
  		}
  		if err != nil {
  			return nil, fmt.Errorf("decompressing profile: %v", err)
  		}
  	}
  	if p, err = ParseUncompressed(data); err != nil && err != errNoData && err != errConcatProfile {
  		p, err = parseLegacy(data)
  	}
  
  	if err != nil {
  		return nil, fmt.Errorf("parsing profile: %v", err)
  	}
  
  	if err := p.CheckValid(); err != nil {
  		return nil, fmt.Errorf("malformed profile: %v", err)
  	}
  	return p, nil
  }
docs: // ParseData parses a profile from a buffer and checks for its
  // validity.