input: Write a python function to determine if a message is needed based on the build's mode and result.
  assert isMessageNeeded("all", "SUCCESS") == True
  assert isMessageNeeded("failing", "SUCCESS") == False
  assert isMessageNeeded("exception", "EXCEPTION") == True
output: def isMessageNeeded(mode, result):
      if mode == "all":
          return True
      if mode == "failing" and result == "SUCCESS":
          return False
      if mode == "exception" and result == "EXCEPTION":
          return True
      return False