def parse_message(message):
 events = []
 if (message['action'] in ['create', 'delete']):
  events.append(parse_create_or_delete(message))
 elif (message['action'] == 'change'):
  if message['change']['diff']:
   for value in message['change']['diff']:
    parsed_event = parse_change_event(value, message)
    if parsed_event:
     events.append(parsed_event)
  if message['change']['comment']:
   events.append(parse_comment(message))
 return events

def parse_message ( message ) : events = [ ] if ( message [ 'action' ] in [ 'create' , 'delete' ] ) : events . append ( parse_create_or_delete ( message ) ) elif ( message [ 'action' ] == 'change' ) : if message [ 'change' ] [ 'diff' ] : for value in message [ 'change' ] [ 'diff' ] : parsed_event = parse_change_event ( value , message ) if parsed_event : events . append ( parsed_event ) if message [ 'change' ] [ 'comment' ] : events . append ( parse_comment ( message ) ) return events
parses the payload by delegating to specialized functions .