code: def fix_datagrepper_message(message):
      
      if not ('source_name' in message and 'source_version' in message):
          return message
  
      # Don't mutate the original message
      message = message.copy()
  
      del message['source_name']
      del message['source_version']
      # datanommer adds the headers field to the message in all cases.
      # This is a huge problem because if the signature was generated with a 'headers'
      # key set and we delete it here, messages will fail validation, but if we don't
      # messages will fail validation if they didn't have a 'headers' key set.
      #
      # There's no way to know whether or not the headers field was part of the signed
      # message or not. Generally, the problem is datanommer is mutating messages.
      if 'headers' in message and not message['headers']:
          del message['headers']
      if 'timestamp' in message:
          message['timestamp'] = int(message['timestamp'])
  
      return message
docs: See if a message is (probably) a datagrepper message and attempt to mutate
      it to pass signature validation.
  
      Datagrepper adds the 'source_name' and 'source_version' keys. If messages happen
      to use those keys, they will fail message validation. Additionally, a 'headers'
      dictionary is present on all responses, regardless of whether it was in the
      original message or not. This is deleted if it's null, which won't be correct in
      all cases. Finally, datagrepper turns the 'timestamp' field into a float, but it
      might have been an integer when the message was signed.
  
      A copy of the dictionary is made and returned if altering the message is necessary.
  
      I'm so sorry.
  
      Args:
          message (dict): A message to clean up.
  
      Returns:
          dict: A copy of the provided message, with the datagrepper-related keys removed
              if they were present.