def METHOD_NAME(bus, message, not_used):
  t = message.type
  if t == Gst.MessageType.EOS:
    sys.stdout.write("End-of-stream\n")
    Gtk.main_quit()
  elif t == Gst.MessageType.ERROR:
    err, debug = message.parse_error()
    sys.stderr.write("Error: %s: %s\n" % (err, debug))
    element = message.src
    #Gtk.main_quit()
  return True