code: func (lc *Lifecycle) Metadata(channel string, cc string, collections bool) *chaincode.Metadata {
  	queryCreator := lc.queryCreatorsByChannel[channel]
  	if queryCreator == nil {
  		Logger.Warning("Requested Metadata for non-existent channel", channel)
  		return nil
  	}
  	// Search the metadata in our local cache, and if it exists - return it, but only if
  	// no collections were specified in the invocation.
  	if md, found := lc.deployedCCsByChannel[channel].Lookup(cc); found && !collections {
  		Logger.Debug("Returning metadata for channel", channel, ", chaincode", cc, ":", md)
  		return &md
  	}
  	query, err := queryCreator.NewQuery()
  	if err != nil {
  		Logger.Error("Failed obtaining new query for channel", channel, ":", err)
  		return nil
  	}
  	md, err := DeployedChaincodes(query, AcceptAll, collections, cc)
  	if err != nil {
  		Logger.Error("Failed querying LSCC for channel", channel, ":", err)
  		return nil
  	}
  	if len(md) == 0 {
  		Logger.Info("Chaincode", cc, "isn't defined in channel", channel)
  		return nil
  	}
  
  	return &md[0]
  }
docs: // Metadata returns the metadata of the chaincode on the given channel,
  // or nil if not found or an error occurred at retrieving it