<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _obtain_sampled_health_pills(self, run, node_names):
 """Obtains the health pills for a run sampled by the event multiplexer. This is much faster than the alternative path of reading health pills from disk. Args: run: The run to fetch health pills for. node_names: A list of node names for which to retrieve health pills. Returns: A dictionary mapping from node name to a list of event_accumulator.HealthPillEvents. """

    runs_to_tags_to_content = self._event_multiplexer.PluginRunToTagToContent(
        constants.DEBUGGER_PLUGIN_NAME)

    if run not in runs_to_tags_to_content:
      # The run lacks health pills.
      return {}

    # This is also a mapping between node name and plugin content because this
    # plugin tags by node name.
    tags_to_content = runs_to_tags_to_content[run]

    mapping = {}
    for node_name in node_names:
      if node_name not in tags_to_content:
        # This node lacks health pill data.
        continue

      health_pills = []
      for tensor_event in self._event_multiplexer.Tensors(run, node_name):
        json_string = tags_to_content[node_name]
        try:
          content_object = json.loads(tf.compat.as_text(json_string))
          device_name = content_object['device']
          output_slot = content_object['outputSlot']
          health_pills.append(
              self._tensor_proto_to_health_pill(tensor_event, node_name,
                                                device_name, output_slot))
        except (KeyError, ValueError) as e:
          logger.error('Could not determine device from JSON string '
                           '%r: %r', json_string, e)

      mapping[node_name] = health_pills

    return mapping