code: def replay_messages(filepath, process_message, *args, **kwargs):
      ''' Take pulse messages from a file and process each with process_message.
  
      :param filepath: File containing dumped pulse messages
      :type filepath: str
      :param process_message: Function to process each pulse message with
      :type process_message: function
      :param *args: Arguments to be passed to process_message()
      :type *args: tuple
      :param **kwargs: Keyword argument to be passed to process_message()
      :type **kwargs: dict
  
      :returns: Nothing
      :rtype: None
  
      '''
      message = Mock()
  
      file_contents = _read_file(filepath)
      for line in file_contents.splitlines():
          # Using ast.literal_eval to turn pulse message strings into dicts
          process_message(ast.literal_eval(line), message, *args, **kwargsf replay_messages(filepath, process_message, *args, **kwargs):
      ''' Take pulse messages from a file and process each with process_message.
  
      :param filepath: File containing dumped pulse messages
      :type filepath: str
      :param process_message: Function to process each pulse message with
      :type process_message: function
      :param *args: Arguments to be passed to process_message()
      :type *args: tuple
      :param **kwargs: Keyword argument to be passed to process_message()
      :type **kwargs: dict
  
      :returns: Nothing
      :rtype: None
  
      '''
      message = Mock()
  
      file_contents = _read_file(filepath)
      for line in file_contents.splitlines():
          # Using ast.literal_eval to turn pulse message strings into dicts
          process_message(ast.literal_eval(line), message, *args, **kwargs)
docs: Take pulse messages from a file and process each with process_message.
  
      :param filepath: File containing dumped pulse messages
      :type filepath: str
      :param process_message: Function to process each pulse message with
      :type process_message: function
      :param *args: Arguments to be passed to process_message()
      :type *args: tuple
      :param **kwargs: Keyword argument to be passed to process_message()
      :type **kwargs: dict
  
      :returns: Nothing
      :rtype: None