code: def _create_lock(path):
      """Create lock based on file system capabilities
  
      Determine if we can rely on the fcntl module for locking files.
      Otherwise, fallback on using the directory creation atomicity as a locking mechanism.
      """
      file_system = _get_fs(path)
  
      if _fs_support_globalflock(file_system):
          log.debug("Using flock.")
          return FileLock(path)
      else:
          log.debug(
              "Cluster does not support flock. Falling back to softfilelock."
          )
          return SoftFileLock(path)
  
imports: import logging
  import os
  import pickle
  from contextlib import contextmanager
  from pickle import PicklingError
  import psutil
  from filelock import FileLock, SoftFileLock, Timeout
  import orion.core
  from orion.core.io.database import Database, DatabaseTimeout
  from orion.core.io.database.ephemeraldb import EphemeralDB
label_desc: Use image node_id 6 for calling a global function with example usage: _create_lock(path) and returns: FileLock, SoftFileLock