def get_log_for_test(test_name, log_path, dt_format):
  """
  Gets the portion of the log file relevant to the test (i.e lies between the start and end times of the test).
  It is assumed that every line in the log file starts with a datetime following dtformat.
  :param test_name: the test name
  :param log_path: the absolute path to the log file
  :param dt_format: the format of the datetime in the log file. This could simply be an example datetime because
                   only the word count matters
  """
  word_count = len(dt_format.split())

  start_time = datetime.fromtimestamp(runtime.get_active_test_start_time(test_name))
  end_time = datetime.fromtimestamp(runtime.get_active_test_end_time(test_name))

  start_pos = _search_log_for_datetime(log_path, start_time, word_count)
  end_pos = _search_log_for_datetime(log_path, end_time, word_count, reverse=True)

  with open(log_path, 'r') as log:
    log.seek(start_pos)
    return log.read(start_pos - end_pos)
dataset/ETHPy150Open linkedin/Zopkio/zopkio/test_utils.py/get_log_for_test/swapped operands of `-`