def METHOD_NAME(self, wave_size: int) -> 'MemoryManager.AllocatedSlot':
    """
    Allocates a memory slot with at least the specified wave size.
    Args:
        wave_size: number of samples of the waveform
    Returns:
        allocated slot
    """
    if wave_size > self._max_waveform_size:
        raise Exception(f'AWG wave with {wave_size} samples is too long. '
                        f'Max size={self._max_waveform_size}. Increase '
                        f'waveform size limit with set_waveform_limit().')
    for slot_size in self._slot_sizes:
        if wave_size > slot_size:
            continue
        if slot_size > self._created_size:
            # slots of this size are not initialized.
            break
        if len(self._free_memory_slots[slot_size]) > 0:
            slot = self._free_memory_slots[slot_size].pop(0)
            self._allocation_ref_count += 1
            self._slots[slot].allocation_ref = self._allocation_ref_count
            self._slots[slot].allocated = True
            self._slots[slot].allocation_time = datetime.now().strftime('%H:%M:%S.%f')
            if MemoryManager.verbose:
                self._log.debug(f'Allocated slot {slot}')
            return MemoryManager.AllocatedSlot(slot, self._slots[slot].allocation_ref, self)
    raise Exception(f'No free memory slots left for waveform with'
                    f' {wave_size} samples.')