def _ConvertOldMastersFormatToNew(masters_to_blacklisted_steps):
  """Converts the old masters format to the new rules dict.

  Args:
    masters_to_blacklisted_steps: A dict in the format:
    {
        'master1': ['step1', 'step2', ...],
        'master2': ['step3', 'step4', ...]
    }

  Returns:
    A dict in the latest rules dict format:
    {
        'supported_masters': {
            'master1': {
                'unsupported_steps: ['step1', 'step2', ...], (if any)
            }
        },
        'global': {}
    }
  """
  supported_masters = {}
  steps_for_masters_rules_in_latest_format = {
      'supported_masters': supported_masters,
      'global': {}
  }

  for master, unsupported_steps in masters_to_blacklisted_steps.iteritems():
    supported_masters[master] = {}
    if unsupported_steps:
      supported_masters[master]['unsupported_steps'] = unsupported_steps

  return steps_for_masters_rules_in_latest_format