code: def load_best_record(
      filename, workload_key=None, target=None, include_compatible=False
  ):
      """Return the best measurement pair form a log file. This may return none results if
      there is no legal measure pair with the specified workload_key/target found from the log file.
  
      Parameters
      ----------
      filename : str
          File name to load log from.
      workload_key : Optional[str]
          The workload key of the compute declaration.
          With `None`, this returns the best measure pair of all workloads.
      target : Optional[tvm.target.Target]
          The target device.
          With `None`, this returns the best measure pair of all target devices.
      include_compatible: bool
          When set to True, all compatible records in the log file will be considered.
  
      Returns
      -------
      input : auto_scheduler.measure.MeasureInput
          The best State's MeasureInput from this log fine.
      result : auto_scheduler.measure.MeasureResult
          The best State's MeasureResult from this log fine.
      """
      log_reader = RecordReader(filename)
      best_cost = 1e30
      best_inp = None
      best_res = None
  
      for inp, res in log_reader:
          if res.error_no != MeasureErrorNo.NO_ERROR:
              continue
          if target and inp.task.target.kind.name != target.kind.name:
              continue
  
          costs = [v.value for v in res.costs]
          cost = np.mean(costs)
  
          if workload_key is not None:
              dis_f = calc_workload_dis_factor(
                  decode_workload_key(workload_key),
                  decode_workload_key(inp.task.workload_key),
              )
              if dis_f == float("inf"):
                  continue
              if not include_compatible and dis_f != 1:
                  continue
  
              # Since different workloads have different FLOPS, we multiply the factor to
              # eliminate this difference, which is basically the concept of throughput.
              cost *= dis_f
  
          if cost < best_cost:
              best_cost = cost
              best_inp = inp
              best_res = res
  
      return best_inp, best_res
  
imports: import argparse
  import logging
  import os
  import itertools
  import numpy
  import tvm._ffi
  from tvm.runtime import Object
  from .measure import MeasureErrorNo, MeasureCallback
  from .utils import calc_workload_dis_factor, decode_workload_key
  from .None import _ffi_api
label_desc: Use image node_id 5 for calling a global function with example usage: load_best_record(filename, workload_key, target, include_compatible) and returns: best_inp,  best_res