<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query(self, watch_key, time_indices=None, slicing=None, mapping=None):
 """Query tensor store for a given watch_key. Args: watch_key: The watch key to query. time_indices: A numpy-style slicing string for time indices. E.g., `-1`, `:-2`, `[::2]`. If not provided (`None`), will use -1. slicing: A numpy-style slicing string for individual time steps. mapping: An mapping string or a list of them. Supported mappings: `{None, 'image/png', 'health-pill'}`. Returns: The potentially sliced values as a nested list of values or its mapped format. A `list` of nested `list` of values. Raises: ValueError: If the shape of the sliced array is incompatible with mapping mode. Or if the mapping type is invalid. """

    if watch_key not in self._tensor_data:
      raise KeyError("watch_key not found: %s" % watch_key)

    if time_indices is None:
      time_indices = '-1'
    time_slicing = tensor_helper.parse_time_indices(time_indices)
    all_time_indices = list(range(self._tensor_data[watch_key].num_total()))
    sliced_time_indices = all_time_indices[time_slicing]
    if not isinstance(sliced_time_indices, list):
      sliced_time_indices = [sliced_time_indices]

    recombine_and_map = False
    step_mapping = mapping
    if len(sliced_time_indices) > 1 and mapping not in (None, ):
      recombine_and_map = True
      step_mapping = None

    output = []
    for index in sliced_time_indices:
      value = self._tensor_data[watch_key].query(index)[0]
      if (value is not None and
          not isinstance(value, debug_data.InconvertibleTensorProto)):
        output.append(tensor_helper.array_view(
            value, slicing=slicing, mapping=step_mapping)[2])
      else:
        output.append(None)

    if recombine_and_map:
      if mapping == 'image/png':
        output = tensor_helper.array_to_base64_png(output)
      elif mapping and mapping != 'none':
        logger.warn(
            'Unsupported mapping mode after recomining time steps: %s',
            mapping)
    return output