class_docstr: Graph represention of Pipeline Term dependencies that includes metadata
  about extra rows required to perform computations.
  
  Each node in the graph has an `extra_rows` attribute, indicating how many,
  if any, extra rows we should compute for the node.  Extra rows are most
  often needed when a term is an input to a rolling window computation.  For
  example, if we compute a 30 day moving average of price from day X to day
  Y, we need to load price data for the range from day (X - 29) to day Y.
  
  Parameters
  ----------
  terms : dict
      A dict mapping names to final output terms.
  all_dates : pd.DatetimeIndex
      An index of all known trading days for which ``terms`` will be
      computed.
  start_date : pd.Timestamp
      The first date for which output is requested for ``terms``.
  end_date : pd.Timestamp
      The last date for which output is requested for ``terms``.
  
  Attributes
  ----------
  outputs
  offset
  extra_rows
  
  Methods
  -------
  ordered()
      Return a topologically-sorted iterator over the terms in self.
class_docstr_tok: ["Graph","represention","of","Pipeline","Term","dependencies","that","includes","metadata","about","extra","rows","required","to","perform","computations",".","Each","node","in","the","graph","has","an","`","extra_rows","`","attribute",",","indicating","how","many",",","if","any",",","extra","rows","we","should","compute","for","the","node",".","Extra","rows","are","most","often","needed","when","a","term","is","an","input","to","a","rolling","window","computation",".","For","example",",","if","we","compute","a","30","day","moving","average","of","price","from","day","X","to","day","Y",",","we","need","to","load","price","data","for","the","range","from","day","(","X","-","29",")","to","day","Y.","Parameters","--","--","--","--","--","terms",":","dict","A","dict","mapping","names","to","final","output","terms",".","all_dates",":","pd.DatetimeIndex","An","index","of","all","known","trading","days","for","which","``","terms","``","will","be","computed",".","start_date",":","pd.Timestamp","The","first","date","for","which","output","is","requested","for","``","terms","``",".","end_date",":","pd.Timestamp","The","last","date","for","which","output","is","requested","for","``","terms","``",".","Attributes","--","--","--","--","--","outputs","offset","extra_rows","Methods","--","--","--","-","ordered","(",")","Return","a","topologically-sorted","iterator","over","the","terms","in","self","."]
docstr: Load mask and mask row labels for term.
  
  Parameters
  ----------
  term : Term
      The term to load the mask and labels for.
  root_mask_term : Term
      The term that represents the root asset exists mask.
  workspace : dict[Term, any]
      The values that have been computed for each term.
  all_dates : pd.DatetimeIndex
      All of the dates that are being computed for in the pipeline.
  
  Returns
  -------
  mask : np.ndarray
      The correct mask for this term.
  dates : np.ndarray
      The slice of dates for this term.
docstr_tok: ["Load","mask","and","mask","row","labels","for","term",".","Parameters","--","--","--","--","--","term",":","Term","The","term","to","load","the","mask","and","labels","for",".","root_mask_term",":","Term","The","term","that","represents","the","root","asset","exists","mask",".","workspace",":","dict","[","Term",",","any","]","The","values","that","have","been","computed","for","each","term",".","all_dates",":","pd.DatetimeIndex","All","of","the","dates","that","are","being","computed","for","in","the","pipeline",".","Returns","--","--","--","-","mask",":","np.ndarray","The","correct","mask","for","this","term",".","dates",":","np.ndarray","The","slice","of","dates","for","this","term","."]
code: def mask_and_dates_for_term(
      self, term, root_mask_term, workspace, all_dates
  ):
      """
      Load mask and mask row labels for term.
  
      Parameters
      ----------
      term : Term
          The term to load the mask and labels for.
      root_mask_term : Term
          The term that represents the root asset exists mask.
      workspace : dict[Term, any]
          The values that have been computed for each term.
      all_dates : pd.DatetimeIndex
          All of the dates that are being computed for in the pipeline.
  
      Returns
      -------
      mask : np.ndarray
          The correct mask for this term.
      dates : np.ndarray
          The slice of dates for this term.
      """
      mask = term.mask
      mask_offset = self.extra_rows[mask] - self.extra_rows[term]
  
      # This offset is computed against root_mask_term because that is what
      # determines the shape of the top-level dates array.
      dates_offset = (
          self.extra_rows[root_mask_term] - self.extra_rows[term]
      )
  
      return workspace[mask][mask_offset:], all_dates[dates_offset:]
  
imports: from networkx import DiGraph, topological_sort
  from six import iteritems, itervalues
  from catalyst.utils.memoize import lazyval
  from catalyst.pipeline.visualize import display_graph
  from .term import LoadableTerm
label_desc: Use image node_id 6 for calling the ExecutionPlan obj's underlying member method code with example usage: obj.mask_and_dates_for_term(term, root_mask_term, workspace, all_dates) and returns: workspace,  all_dates