code: def _matching_packages(ref):
      from guild import model as modellib
  
      matches = {}
      for model in modellib.iter_models():
          if model.reference.dist_type != "package":
              continue
          name = model.reference.dist_name
          gf = model.modeldef.guildfile
          # If exact match, return one
          if ref == name:
              return [(name, gf)]
          # otherwise check for match in full name of model
          matches[name] = gf
      return sorted(matches.items())
  
imports: import logging
  import os
  import typing
  from guild import cli
  from guild import click_util
  from guild import config
label_desc: Use image node_id 14 for calling a global function with example usage: _matching_packages(ref) and returns: sorted, list