def __init__(self, name, command, realm=None, monitoring_groups=None,
                 **kwargs):
        self.name = name
        self.realm = realm
        if not isinstance(command, Command):
            try:
                command = Command.registry[command]
            except KeyError:
                logger.error("Unable to find Command '%s' in registry.",
                             command)
                raise

        self.command = command
        self.monitoring_groups = WeakValueDictionary()
        if monitoring_groups:
            for group in monitoring_groups:
                if not isinstance(group, MonitoringGroup):
                    try:
                        group = MonitoringGroup.registry[group]
                    except __HOLE__:
                        logger.error("Unable to find MonitoringGroup '%s' in "
                                     "registry.", group)
                        raise
                group.add_monitor(self)

        super(Monitor, self).__init__(name, **kwargs)
dataset/ETHPy150Open cloudtools/nymms/nymms/resources.py/Monitor.__init__