code: def check_directory_permissions(
      path: str, mount_root: Optional[str] = "", unmount: bool = False
  ):
      """
      Utility function to check user write permissions on given path.
      Optionally can unmount the the given path.
      """
      if not os.access(path, os.W_OK):
          username = get_username()
          if unmount:
              unmount_remote_repo(path, mount_root)
          raise PermissionError(
              f"User {username} does not have write permissions on path: {path}."
          )
  
file_path: aim/aim/ext/sshfs/utils.py
imports: import os
  import platform
  import shutil
  import subprocess
  import time
  import logging
  from typing import Optional, Tuple
label_desc: Use image node_id 3 for calling a global function with example usage: check_directory_permissions(path, mount_root, unmount) without return types