<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set(self, key, samples, sampling_rate):
 """ Set the samples and sampling-rate for the given key. Existing data will be overwritten. The samples have to have ``np.float32`` datatype and values in the range of -1.0 and 1.0. Args: key (str):
 A key to store the data for. samples (numpy.ndarray):
 1-D array of audio samples (np.float32). sampling_rate (int):
 The sampling-rate of the audio samples. Note: The container has to be opened in advance. """

        if not np.issubdtype(samples.dtype, np.floating):
            raise ValueError('Samples are required as np.float32!')

        if len(samples.shape) > 1:
            raise ValueError('Only single channel supported!')

        self.raise_error_if_not_open()

        if key in self._file:
            del self._file[key]

        samples = (samples * MAX_INT16_VALUE).astype(np.int16)

        dset = self._file.create_dataset(key, data=samples)
        dset.attrs[SAMPLING_RATE_ATTR] = sampling_rate