import collections


def DataFixture(data):
  """Creates a pseudo class out of the parameter dictionary `data`, and
  populates the object such that calling `object.foo` will return `bar` if the
  input dictionary has a key/value pair `"foo": "bar"`."""
  # Transform keys to remove invalid characters, like ` `.
  assert all([all([c.isalnum() or c=='_' for c in key]) for key in data.keys()]), "All dictionary keys must be valid python variable names"
  DataPseudoClass = collections.namedtuple('DataPseudoClass', data.keys())
  return DataPseudoClass(**data)