class_docstr: Helper for mocking subprocess calls
code: def _sacct(self, state: str, job_id: str, array: int) -> str:
      if array == 0:
          lines = self.SACCT_JOB.format(j=job_id, state=state)
      else:
          lines = "\n".join(
              self.SACCT_JOB.format(j=f"{job_id}_{i}", state=state)
              for i in range(array)
          )
      return "\n".join((self.SACCT_HEADER, lines))
  
imports: import contextlib
  import pickle
  import subprocess
  import sys
  import time
  import typing
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  from .None import core, submission, utils
label_desc: Use image node_id 7 for calling the MockedSubprocess obj's underlying member method code with example usage: obj._sacct(state, job_id, array) and returns: str