code: def test_logger(
      name, filetype, command, test_log_file, sample_log_file
  ):
      # Run command and validate outputs.
      result = run_command_and_get_result(command)
  
      assert result.stdout is not None
      assert result.stderr is not None
      assert result.returncode == 0
      assert os.path.exists(
          test_log_file
      ), f"{test_log_file} did not get generated"
  
      if filetype == "json":
          with open(sample_log_file) as f:
              desired_dictionary = json.load(f)
  
          with open(test_log_file) as f:
              test_dictionary = json.load(f)
  
          assert (
              desired_dictionary == test_dictionary
          ), f"{filetype} file {test_log_file} differs from {sample_log_file}"
  
      elif filetype == "txt":
          assert (
              os.system(f"diff {test_log_file} {sample_log_file}") == 0
          ), f"{filetype} file {test_log_file} differs from {sample_log_file}"
  
      elif filetype == "csv":
          import pandas as pd
  
          # Convert them into dataframes and compare.
          test_df = pd.read_csv(test_log_file)
          sample_df = pd.read_csv(sample_log_file)
          try:
              test_df = test_df[sorted(list(test_df.columns.values))]
              sample_df = sample_df[
                  sorted(list(test_df.columns.values))
              ]
  
              for c in test_df.columns:
                  if test_df[c].dtype == int:
                      test_df[c] = test_df[c].astype(float)
  
                  if sample_df[c].dtype == int:
                      sample_df[c] = sample_df[c].astype(float)
          except KeyError:
              assert (
                  False
              ), f"{filetype} file {test_log_file} differs from {sample_log_file}"
  
          assert sample_df.equals(
              test_df
          ), f"{filetype} file {test_log_file} differs from {sample_log_file}"
  
      # cleanup
      os.remove(test_log_file)
  
imports: import json
  import os
  from helpers import run_command_and_get_result
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_logger(name, filetype, command, test_log_file, sample_log_file) without return types