code: def overwrite_from_dates(
      asof, dense_dates, sparse_dates, asset_idx, value
  ):
      """Construct an Overwrite with the correct
      start and end date based on the asof date of the delta,
      the dense_dates, and the dense_dates.
  
      Parameters
      ----------
      asof : datetime
          The asof date of the delta.
      dense_dates : pd.DatetimeIndex
          The dates requested by the loader.
      sparse_dates : pd.DatetimeIndex
          The dates that appeared in the dataset.
      asset_idx : tuple of int
          The index of the asset in the block. If this is a tuple, then this
          is treated as the first and last index to use.
      value : any
          The value to overwrite with.
  
      Returns
      -------
      overwrite : Float64Overwrite
          The overwrite that will apply the new value to the data.
  
      Notes
      -----
      This is forward-filling all dense dates that are between the asof_date date
      and the next sparse date after the asof_date.
  
      For example:
      let ``asof = pd.Timestamp('2014-01-02')``,
          ``dense_dates = pd.date_range('2014-01-01', '2014-01-05')``
          ``sparse_dates = pd.to_datetime(['2014-01', '2014-02', '2014-04'])``
  
      Then the overwrite will apply to indexes: 1, 2, 3, 4
      """
      if asof is pd.NaT:
          # Not an actual delta.
          # This happens due to the groupby we do on the deltas.
          return
  
      first_row = dense_dates.searchsorted(asof)
      next_idx = sparse_dates.searchsorted(asof.asm8, "right")
      if next_idx == len(sparse_dates):
          # There is no next date in the sparse, this overwrite should apply
          # through the end of the dense dates.
          last_row = len(dense_dates) - 1
      else:
          # There is a next date in sparse dates. This means that the overwrite
          # should only apply until the index of this date in the dense dates.
          last_row = (
              dense_dates.searchsorted(sparse_dates[next_idx]) - 1
          )
  
      if first_row > last_row:
          return
  
      first, last = asset_idx
      yield make_adjustment_from_indices(
          first_row, last_row, first, last, OVERWRITE, value
      )
  
imports: from __future__ import division, absolute_import
  from abc import ABCMeta, abstractproperty
  from collections import namedtuple, defaultdict
  from functools import partial
  from itertools import count
  import warnings
  from weakref import WeakKeyDictionary
  import blaze
  from datashape import Date, DateTime, Option, isrecord, isscalar
  import numpy
  from odo import odo
  import pandas
  from six import with_metaclass, PY2, itervalues, iteritems
  from toolz import complement, compose, flip, groupby, identity, memoize, merge
  import toolz.curried.operator
  from catalyst.pipeline.common import AD_FIELD_NAME, SID_FIELD_NAME, TS_FIELD_NAME
  from catalyst.pipeline.data.dataset import DataSet, Column
  from catalyst.pipeline.loaders.utils import check_data_query_args, last_in_date_group, normalize_data_query_bounds, normalize_timestamp_to_query_time, ffill_across_cols
  from catalyst.pipeline.sentinels import NotSpecified
  from catalyst.lib.adjusted_array import AdjustedArray, can_represent_dtype
  from catalyst.lib.adjustment import make_adjustment_from_indices, OVERWRITE
  from catalyst.utils.input_validation import expect_element, ensure_timezone, optionally
  from catalyst.utils.numpy_utils import bool_dtype
  from catalyst.utils.pool import SequentialPool
  from catalyst.utils.preprocess import preprocess
label_desc: Use image node_id 10 for calling a global function with example usage: overwrite_from_dates(asof, dense_dates, sparse_dates, asset_idx, value) without return types