def save_callback(operation, graphdef):
 if (operation == 'test'):
  for e in graphdef.expressions:
   if expression_ok(e):
    graphdef.expression = e
    display_graph(graphdef)
    return
  mestate.console.writeln('Invalid graph expressions', fg='red')
  return
 if (operation == 'save'):
  save_graph(graphdef, mestate)

def save_callback ( operation , graphdef ) : if ( operation == 'test' ) : for e in graphdef . expressions : if expression_ok ( e ) : graphdef . expression = e display_graph ( graphdef ) return mestate . console . writeln ( 'Invalid graph expressions' , fg = 'red' ) return if ( operation == 'save' ) : save_graph ( graphdef , mestate )
callback from save thread .