docs: def write(self, symbol, data, initial_image=None, metadata=None):
          """
          Writes a list of market data events.
  
          Parameters
          ----------
          symbol : `str`
              symbol name for the item
          data : list of dicts or a pandas.DataFrame
              List of ticks to store to the tick-store.
              if a list of dicts, each dict must contain a 'index' datetime
              if a pandas.DataFrame the index must be a Timestamp that can be converted to a datetime.
              Index names will not be preserved.
          initial_image : dict
              Dict of the initial image at the start of the document. If this contains a 'index' entry it is
              assumed to be the time of the timestamp of the index
          metadata: dict
              optional user defined metadata - one per symbol
          """
          pandas = False
          # Check for overlapping data
          if isinstance(data, list):
              start = data[0]['index']
              end = data[-1]['index']
          elif isinstance(data, pd.DataFrame):
              start = data.index[0].to_pydatetime()
              end = data.index[-1].to_pydatetime()
              pandas = True
          else:
              raise UnhandledDtypeException("Can't persist type %s to tickstore" % type(data))
          self._assert_nonoverlapping_data(symbol, to_dt(start), to_dt(end))
  
          if pandas:
              buckets = self._pandas_to_buckets(data, symbol, initial_image)
          else:
              buckets = self._to_buckets(data, symbol, initial_image)
          self._write(buckets)
  
          if metadata:
              self._metadata.replace_one({SYMBOL: symbol},
                                         {SYMBOL: symbol, META: metadata},
                                         upsert=True)