def index_resolver(index, strict=False):
  """Returns a function that accepts a value and returns index[value]."""
  if strict:
    return lambda id_: index[id_]
  else:
    return index.get
Returns a function that accepts a value and returns index[value].