#NEWLINE# def get_or_create( model , **kwargs ) : #NEWLINE# #INDENT# instance = model . query . filter_by ( ** kwargs ) . first ( ) #NEWLINE# if ( instance is None ) : #NEWLINE# #INDENT# instance = model ( ** kwargs ) #NEWLINE# db . session . add ( model ) #NEWLINE# #UNINDENT# return instance