code: def find_log_dir(log_dir=None):
    
    # Get a list of possible log dirs (will try to use them in order).
    if log_dir:
      # log_dir was explicitly specified as an arg, so use it and it alone.
      dirs = [log_dir]
    elif FLAGS['log_dir'].value:
      # log_dir flag was provided, so use it and it alone (this mimics the
      # behavior of the same flag in logging.cc).
      dirs = [FLAGS['log_dir'].value]
    else:
      dirs = ['/tmp/', './']
  
    # Find the first usable log dir.
    for d in dirs:
      if os.path.isdir(d) and os.access(d, os.W_OK):
        return d
    _absl_logger.fatal("Can't find a writable directory for logs, tried %s", dirs)
docs: Returns the most suitable directory to put log files into.
  
    Args:
      log_dir: str|None, if specified, the logfile(s) will be created in that
          directory.  Otherwise if the --log_dir command-line flag is provided,
          the logfile will be created in that directory.  Otherwise the logfile
          will be created in a standard location.