#NEWLINE# def plan( project , **kwargs ) : #NEWLINE# #INDENT# if ( 'label' not in kwargs ) : #NEWLINE# #INDENT# kwargs [ 'label' ] = PLAN_NAMES . next ( ) #NEWLINE# #UNINDENT# plan = Plan . query . filter ( ( Plan . label == kwargs [ 'label' ] ) , ( Plan . project_id == project . id ) ) . first ( ) #NEWLINE# if plan : #NEWLINE# #INDENT# return plan #NEWLINE# #UNINDENT# result = Plan ( project = project , ** kwargs ) #NEWLINE# db . session . add ( plan ) #NEWLINE# return result