code: def _format_event(self, orig_event, external_metadata=None):
          
          event_wrapper = {}
  
          # Add ISO6801 timestamp and frame info
          timestamp = datetime.datetime.utcnow().isoformat()
          event_wrapper[consts.WRAPPER_REPORT_TIME] = timestamp
  
          # Add the enclosing frame
          frame = inspect.currentframe().f_back.f_back
          filename = frame.f_code.co_filename
          line_number = frame.f_lineno
          event_wrapper[consts.WRAPPER_CALLING_FILE] = str(filename)
          event_wrapper[consts.WRAPPER_CALLING_LINE] = str(line_number)
  
          # Add the UUID to the event
          event_wrapper[consts.WRAPPER_UUID] = str(uuid.uuid4())
  
          # Try to set event type. If it throws, put the input label
          try:
              event_wrapper[consts.WRAPPER_EVENT_TYPE] = \
                  self._get_event_type(orig_event)
          except Exception:
              pass  # The event type will be the input name, added by Alooma
  
          # Optionally add external metadata
          if external_metadata and isinstance(external_metadata, dict):
              event_wrapper.update(external_metadata)
  
          # Wrap the event with metadata
          event_wrapper[consts.WRAPPER_MESSAGE] = orig_event
  
          return json_dumps(event_wrapper)
docs: Format the event to the expected Alooma format, packing it into a
          message field and adding metadata
          :param orig_event:         The original event that was sent, should be
                                     dict, str or unicode.
          :param external_metadata:  (Optional) a dict containing metadata to add
                                     to the event
          :return:                   a dict with the original event in a 'message'
                                     field and all the supplied metadata