def get_or_create(model, **kwargs):
    """ use it to get or create object from a table """
    instance = model.selectBy(**kwargs)
    if instance.count():
        return instance
    else:
        instance = model(**kwargs)
        return instance
