<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, symbol, data, metadata=None, upsert=True, as_of=None, **kwargs):
 """ Append 'data' under the specified 'symbol' name to this library. Parameters symbol : `str` symbol name for the item data : `pd.DataFrame` to be persisted metadata : `dict` An optional dictionary of metadata to persist along with the symbol. If None and there are existing metadata, current metadata will be maintained upsert : `bool` Write 'data' if no previous version exists. as_of : `datetime.datetime` The "insert time". Default to datetime.now() """

        local_tz = mktz()
        if not as_of:
            as_of = dt.now()
        if as_of.tzinfo is None:
            as_of = as_of.replace(tzinfo=local_tz)
        data = self._add_observe_dt_index(data, as_of)
        if upsert and not self._store.has_symbol(symbol):
            df = data
        else:
            existing_item = self._store.read(symbol, **kwargs)
            if metadata is None:
                metadata = existing_item.metadata
            df = existing_item.data.append(data).sort_index(kind='mergesort')
        self._store.write(symbol, df, metadata=metadata, prune_previous_version=True)