@classmethod
def find_or_create(cls, query, *args, **kwargs):
    """ Retrieve an element from the database. If it doesn't exist, create
        it.  Calling this method is equivalent to calling find_one and then
        creating an object. Note that this method is not atomic.  """
    result = cls.find_one(query, *args, **kwargs)
    if result is None:
        default = cls._schema.get('default', {})
        default.update(query)
        result = cls(default, *args, **kwargs)
    return result
