def make_fixture(model_class, **kwargs):
all_fields = get_fields(model_class)<EOL>fields_for_random_generation = map(<EOL>lambda x: getattr(model_class, x), all_fields<EOL>)<EOL>overrides = {}<EOL>for kwarg, value in kwargs.items():<EOL><INDENT>if kwarg in all_fields:<EOL><INDENT>kwarg_field = getattr(model_class, kwarg)<EOL>fields_for_random_generation.remove(kwarg_field)<EOL>overrides.update({kwarg_field: value})<EOL><DEDENT><DEDENT>random_values = get_random_values(fields_for_random_generation)<EOL>values = dict(overrides, **random_values)<EOL>assert len(all_fields) == len(values), (<EOL>"<STR_LIT>".format(<EOL>len(all_fields), len(values)<EOL>)<EOL>)<EOL>data = {k.name: v for k, v in values.items()}<EOL>return model_class(**data)<EOL>
Take the model_klass and generate a fixure for it

Args:
    model_class (MongoEngine Document): model for which a fixture
        is needed
    kwargs (dict): any overrides instead of random values

Returns:
    dict for now, other fixture types are not implemented yet