'Get next message from `queue`.'

def _get(self, queue):

    queue_find = ((u'.' + queue) + u'.msg')
    folder = os.listdir(self.data_folder_in)
    folder = sorted(folder)
    while (len(folder) > 0):
        filename = folder.pop(0)
        if (filename.find(queue_find) < 0):
            continue
        if self.store_processed:
            processed_folder = self.processed_folder
        else:
            processed_folder = tempfile.gettempdir()
        try:
            shutil.move(os.path.join(self.data_folder_in, filename), processed_folder)
        except IOError:
            pass
        filename = os.path.join(processed_folder, filename)
        try:
            f = open(filename, u'rb')
            payload = f.read()
            f.close()
            if (not self.store_processed):
                os.remove(filename)
        except (IOError, OSError):
            raise ChannelError(u'Cannot    read    file    {0!r}    from    queue.'.format(filename))
        return loads(bytes_to_str(payload))
    raise Empty()
