code: def set_sampling_strategy(self, sensor_name, strategy_and_parms):
          
          sensor_name = resource.escape_name(sensor_name)
          sensor_obj = dict.get(self._sensor, sensor_name)
          self._sensor_strategy_cache[sensor_name] = strategy_and_parms
          sensor_dict = {}
          self._logger.debug(
                  'Cached strategy {} for sensor {}'
                  .format(strategy_and_parms, sensor_name))
          if sensor_obj:
              # The sensor exists, so set the strategy and continue. Log errors,
              # but don't raise anything
              try:
                  yield sensor_obj.set_sampling_strategy(strategy_and_parms)
                  sensor_dict[sensor_name] = strategy_and_parms
              except Exception as exc:
                  self._logger.exception(
                      'Unhandled exception trying to set sensor strategy {!r} for sensor {} ({})'
                      .format(strategy_and_parms, sensor_name, exc))
                  sensor_dict[sensor_name] = str(exc)
          # Otherwise, depend on self._add_sensors() to handle it from the cache when the sensor appears
          raise tornado.gen.Return(sensor_dict)
docs: Set a strategy for a sensor even if it is not yet known.
          The strategy should persist across sensor disconnect/reconnect.
  
          sensor_name : str
              Name of the sensor
          strategy_and_params : seq of str or str
              As tuple contains (<strat_name>, [<strat_parm1>, ...]) where the strategy
              names and parameters are as defined by the KATCP spec. As str contains the
              same elements in space-separated form.
  
          Returns
          -------
          done : tornado Future
              Resolves when done