class_docstr: Historical restrictions stored in memory with effective dates for each
  asset.
  
  Parameters
  ----------
  restrictions : iterable of namedtuple Restriction
      The restrictions, each defined by an asset, effective date and state
class_docstr_tok: ["Historical","restrictions","stored","in","memory","with","effective","dates","for","each","asset",".","Parameters","--","--","--","--","--","restrictions",":","iterable","of","namedtuple","Restriction","The","restrictions",",","each","defined","by","an","asset",",","effective","date","and","state"]
code: def __init__(self, restrictions):
      # A dict mapping each asset to its restrictions, which are sorted by
      # ascending order of effective_date
      self._restrictions_by_asset = {
          asset: sorted(
              restrictions_for_asset, key=lambda x: x.effective_date
          )
          for asset, restrictions_for_asset in iteritems(
              groupby(lambda x: x.asset, restrictions)
          )
      }
  
imports: import abc
  from numpy import vectorize
  from functools import partial, reduce
  import operator
  import pandas
  from six import with_metaclass, iteritems
  from collections import namedtuple
  from toolz import groupby
  from catalyst.utils.enum import enum
  from catalyst.utils.numpy_utils import vectorized_is_element
  from catalyst.assets import Asset
label_desc: Use image node_id 1 to create a new HistoricalRestrictions object from inherited base classes: Restrictions with example: obj = HistoricalRestrictions(restrictions)