code: def _filter_commands(ctx, commands=None):
      
      lookup = getattr(ctx.command, 'commands', {})
      if not lookup and isinstance(ctx.command, click.MultiCommand):
          lookup = _get_lazyload_commands(ctx.command)
  
      if commands is None:
          return sorted(lookup.values(), key=lambda item: item.name)
  
      names = [name.strip() for name in commands.split(',')]
      return [lookup[name] for name in names if name in lookup]
docs: Return list of used commands.