'Internal method for `write_cols` and `write`.
Parameters
sid : int
The asset identifier for the data being written.
dts : datetime64 array
The dts corresponding to values in cols.
cols : dict of str -> np.array
dict of market data with the following characteristics.
keys are (\'open\', \'high\', \'low\', \'close\', \'volume\')
open : float64
high : float64
low  : float64
close : float64
volume : float64|int64'

def _write_cols(self, sid, dts, cols, invalid_data_behavior):

    table = self._ensure_ctable(sid)
    tds = self._session_labels
    input_first_day = self._calendar.minute_to_session_label(pd.Timestamp(dts[0]), direction='previous')
    last_date = self.last_date_in_output_for_sid(sid)
    day_before_input = (input_first_day - tds.freq)
    self.pad(sid, day_before_input)
    table = self._ensure_ctable(sid)
    num_rec_mins = table.size
    all_minutes = self._minute_index
    last_minute_to_write = pd.Timestamp(dts[(-1)], tz='UTC')
    if (num_rec_mins > 0):
        last_recorded_minute = all_minutes[(num_rec_mins - 1)]
        if (last_minute_to_write <= last_recorded_minute):
            raise BcolzMinuteOverlappingData(dedent('\n                                                                Data    with    last_date={0}    already    includes    input    start={1}    for\n                                                                sid={2}'.strip()).format(last_date, input_first_day, sid))
    latest_min_count = all_minutes.get_loc(last_minute_to_write)
    all_minutes_in_window = all_minutes[num_rec_mins:(latest_min_count + 1)]
    minutes_count = all_minutes_in_window.size
    open_col = np.zeros(minutes_count, dtype=np.uint32)
    high_col = np.zeros(minutes_count, dtype=np.uint32)
    low_col = np.zeros(minutes_count, dtype=np.uint32)
    close_col = np.zeros(minutes_count, dtype=np.uint32)
    vol_col = np.zeros(minutes_count, dtype=np.uint32)
    dt_ixs = np.searchsorted(all_minutes_in_window.values, dts.astype('datetime64[ns]'))
    ohlc_ratio = self.ohlc_ratio_for_sid(sid)
    (open_col[dt_ixs], high_col[dt_ixs], low_col[dt_ixs], close_col[dt_ixs], vol_col[dt_ixs]) = convert_cols(cols, ohlc_ratio, sid, invalid_data_behavior)
    table.append([open_col, high_col, low_col, close_col, vol_col])
    table.flush()
