def _MasterToBotsToDeprecatedDict(suites):
  """Makes a dictionary listing masters, bots and deprecated for tests.

  Args:
    suites: A collection of test suite Test entities. All of the keys in
        this set should have the same test suite name.

  Returns:
    A dictionary mapping master names to bot names to deprecated.
  """
  def MasterName(key):
    return key.pairs()[0][1]

  def BotName(key):
    return key.pairs()[1][1]

  result = {}
  for master in {MasterName(s.key) for s in suites}:
    bot = {}
    for suite in suites:
      if MasterName(suite.key) == master:
        bot[BotName(suite.key)] = suite.deprecated
    result[master] = bot
  return result