code: def disk_usage(path):
      """Return disk usage associated with path.
      Note: UNIX usually reserves 5% disk space which is not accessible
      by user. In this function "total" and "used" values reflect the
      total and used disk space whereas "free" and "percent" represent
      the "free" and "used percent" user disk space.
      """
      if PY3:
          st = os.statvfs(path)
      else:  # pragma: no cover
          # os.statvfs() does not support unicode on Python 2:
          # - https://github.com/giampaolo/psutil/issues/416
          # - http://bugs.python.org/issue18695
          try:
              st = os.statvfs(path)
          except UnicodeEncodeError:
              if isinstance(path, unicode):
                  try:
                      path = path.encode(sys.getfilesystemencoding())
                  except UnicodeEncodeError:
                      pass
                  st = os.statvfs(path)
              else:
                  raise
  
      # Total space which is only available to root (unless changed
      # at system level).
      total = st.f_blocks * st.f_frsize
      # Remaining free space usable by root.
      avail_to_root = st.f_bfree * st.f_frsize
      # Remaining free space usable by user.
      avail_to_user = st.f_bavail * st.f_frsize
      # Total space being used in general.
      used = total - avail_to_root
      # Total space which is available to user (same as 'total' but
      # for the user).
      total_user = used + avail_to_user
      # User usage percent compared to the total amount of space
      # the user can use. This number would be higher if compared
      # to root's because the user has less space (usually -5%).
      usage_percent_user = usage_percent(used, total_user, round_=1)
  
      # NB: the percentage is -5% than what shown by df due to
      # reserved blocks that we are currently not considering:
      # https://github.com/giampaolo/psutil/issues/829#issuecomment-223750462
      return sdiskusage(
          total=total,
          used=used,
          free=avail_to_user,
          percent=usage_percent_user,
      )
  
file_path: catboost/contrib/python/psutil/py3/psutil/_psposix.py
imports: import glob
  import os
  import signal
  import sys
  import time
  from ._common import memoize
  from ._common import sdiskusage
  from ._common import TimeoutExpired
  from ._common import usage_percent
  from ._compat import ChildProcessError
  from ._compat import FileNotFoundError
  from ._compat import InterruptedError
  from ._compat import PermissionError
  from ._compat import ProcessLookupError
  from ._compat import PY3
  from ._compat import unicode
label_desc: Use image node_id 3 for calling a global function with example usage: disk_usage(path) and returns: sdiskusage