'Save data to data directory.
.. versionadded:: 1.8
If ``data`` is ``None``, the datastore will be deleted.
Note that the datastore does NOT support mutliple threads.
:param name: name of datastore
:param data: object(s) to store. **Note:** some serializers
can only handled certain types of data.
:param serializer: name of serializer to use. If no serializer
is specified, the default will be used. See
:class:`SerializerManager` for more information.
:returns: data in datastore or ``None``'

def store_data(self, name, data, serializer=None):

    @uninterruptible
    def delete_paths(paths):
        u'Clear    one    or    more    data    stores'
        for path in paths:
            if os.path.exists(path):
                os.unlink(path)
                self.logger.debug(u'Deleted    data    file    :    {0}'.format(path))
    serializer_name = (serializer or self.data_serializer)
    metadata_path = self.datafile(u'.{0}.alfred-workflow'.format(name))
    filename = u'{0}.{1}'.format(name, serializer_name)
    data_path = self.datafile(filename)
    if (data_path == self.settings_path):
        raise ValueError(((u'Cannot    save    data    to' + u'`{0}`    with    format    `{1}`.    '.format(name, serializer_name)) + u"This    would    overwrite    Alfred-Workflow's    settings    file."))
    serializer = manager.serializer(serializer_name)
    if (serializer is None):
        raise ValueError(u'Invalid    serializer    `{0}`.    Register    your    serializer    with    `manager.register()`    first.'.format(serializer_name))
    if (data is None):
        delete_paths((metadata_path, data_path))
        return
    @uninterruptible
    def _store():
        with atomic_writer(metadata_path, u'wb') as file_obj:
            file_obj.write(serializer_name)
        with atomic_writer(data_path, u'wb') as file_obj:
            serializer.dump(data, file_obj)
    _store()
    self.logger.debug(u'Stored    data    saved    at    :    {0}'.format(data_path))
