code: def disk_partitions(all=False):
      """Return mounted disk partitions as a list of namedtuples."""
      retlist = []
      partitions = cext.disk_partitions()
      for partition in partitions:
          device, mountpoint, fstype, opts = partition
          if device == "none":
              device = ""
          if not all:
              if not os.path.isabs(device) or not os.path.exists(
                  device
              ):
                  continue
          maxfile = maxpath = None  # set later
          ntuple = _common.sdiskpart(
              device, mountpoint, fstype, opts, maxfile, maxpath
          )
          retlist.append(ntuple)
      return retlist
  
imports: import contextlib
  import errno
  import functools
  import os
  from collections import namedtuple
  from .None import _common
  from .None import _psposix
  from .None import _psutil_osx
  from .None import _psutil_posix
  from ._common import AccessDenied
  from ._common import conn_tmap
  from ._common import conn_to_ntuple
  from ._common import isfile_strict
  from ._common import memoize_when_activated
  from ._common import NoSuchProcess
  from ._common import parse_environ_block
  from ._common import usage_percent
  from ._common import ZombieProcess
  from ._compat import PermissionError
  from ._compat import ProcessLookupError
label_desc: Use image node_id 9 for calling a global function with example usage: disk_partitions(all) and returns: retlist