def CheckNodeGroupInstances(cfg, group_uuid, owned_instance_names):
  wanted_instances = frozenset(cfg.GetInstanceNames(
                                 cfg.GetNodeGroupInstances(group_uuid)))
  if owned_instance_names != wanted_instances:
    raise errors.OpPrereqError("Instances in node group '%s' changed since"
                               " locks were acquired, wanted '%s', have '%s';"
                               " retry the operation" %
                               (group_uuid,
                                utils.CommaJoin(wanted_instances),
                                utils.CommaJoin(owned_instance_names)),
                               errors.ECODE_STATE)

  return wanted_instances
get count from internal histogram
dataset/ETHPy150Open ganeti/ganeti/lib/cmdlib/common.py/CheckNodeGroupInstances--crossover with--dataset/ETHPy150Open omergertel/pyformance/pyformance/meters/timer.py/Timer.get_count