code: def _get_value(self, epoch_data: EpochData) -> float:
          
          if self._stream_name not in epoch_data:
              raise KeyError('Stream `{}` was not found in the epoch data.\nAvailable streams are `{}`.'
                             .format(self._stream_name, epoch_data.keys()))
  
          stream_data = epoch_data[self._stream_name]
          if self._variable not in stream_data:
              raise KeyError('Variable `{}` for stream `{}` was not found in the epoch data. '
                             'Available variables for stream `{}` are `{}`.'
                             .format(self._variable, self._stream_name, self._stream_name, stream_data.keys()))
  
          value = stream_data[self._variable]
          if self._aggregation:
              if not isinstance(value, dict):
                  raise TypeError('Variable `{}` is expected to be a dict when aggregation is specified. '
                                  'Got `{}` instead.'.format(self._variable, type(value).__name__))
              if self._aggregation not in value:
                  raise KeyError('Specified aggregation `{}` was not found in the variable `{}`. '
                                 'Available aggregations: `{}`.'.format(self._aggregation, self._variable, value.keys()))
              value = value[self._aggregation]
          if not np.isscalar(value):
              raise ValueError('Variable `{}` value is not a scalar.'.format(value))
  
          return value
docs: Retrieve the value of the monitored variable from the given epoch data.
  
          :param epoch_data: epoch data which determine whether the model will be saved or not
          :raise KeyError: if any of the specified stream, variable or aggregation is not present in the ``epoch_data``
          :raise TypeError: if the variable value is not a dict when aggregation is specified
          :raise ValueError: if the variable value is not a scalar