code: def check_timeout(self, timeout, callback):
      interval = 0.01
      start = datetime.now().timestamp()
      count = int(timeout / interval)
      for x in range(count):
          if callback():
              break
          time.sleep(interval)
      print(
          "checked {} times, {:3F} seconds".format(
              x, datetime.now().timestamp() - start
          )
      )
  
file_path: nni/test/ut/tools/trial_tool/test_file_channel.py
imports: import json
  import os
  import random
  import shutil
  import string
  import sys
  import time
  import unittest
  from argparse import Namespace
  from datetime import datetime
  from nni.tools.trial_tool.base_channel import CommandType
  from nni.tools.trial_tool.file_channel import FileChannel, command_path, manager_commands_file_name
label_desc: Use image node_id 2 for calling the FileChannelTest obj's underlying member method code with example usage: obj.check_timeout(timeout, callback) without return types