def get_or_create(self, **kwargs):
assert kwargs,'<STR_LIT>'<EOL>defaults = kwargs.pop('<STR_LIT>', {})<EOL>lookup = kwargs.copy()<EOL>try:<EOL><INDENT>return self.get(**lookup), False<EOL><DEDENT>except self.model.DoesNotExist:<EOL><INDENT>params = dict([(k, v) for k, v in kwargs.items() if '<STR_LIT>' not in k])<EOL>params.update(defaults)<EOL>obj = self.model(**params)<EOL>obj.save(force_insert=True)<EOL>return obj, True<EOL><DEDENT>
Looks up an object with the given kwargs, creating one if necessary.
Returns a tuple of (object, created), where created is a boolean
specifying whether an object was created.