code: def execute_only_once():
      """
      Each called in the code to this function is guaranteed to return True the
      first time and False afterwards.
  
      Returns:
          bool: whether this is the first time this function gets called from this line of code.
  
      Example:
          .. code-block:: python
  
              if execute_only_once():
                  # do something only once
      """
      f = inspect.currentframe().f_back
      ident = (f.f_code.co_filename, f.f_lineno)
      if ident in _EXECUTE_HISTORY:
          return False
      _EXECUTE_HISTORY.add(ident)
      return True
  
file_path: tensorpack/tensorpack/utils/utils.py
imports: import inspect
  import numpy
  import re
  import os
  import sys
  from contextlib import contextmanager
  from datetime import datetime, timedelta
  from tqdm import tqdm
  from .None import logger
  from .concurrency import subproc_call
label_desc: Use image node_id 5 for calling a global function with example usage: execute_only_once() and returns: True, False