code: def can_chmod():
      global _can_chmod
      if _can_chmod is not None:
          return _can_chmod
      if not hasattr(os, "chmod"):
          _can_chmod = False
          return _can_chmod
      try:
          with open(TESTFN, "wb") as f:
              try:
                  os.chmod(TESTFN, 0o555)
                  mode1 = os.stat(TESTFN).st_mode
                  os.chmod(TESTFN, 0o777)
                  mode2 = os.stat(TESTFN).st_mode
              except OSError as e:
                  can = False
              else:
                  can = stat.S_IMODE(mode1) != stat.S_IMODE(mode2)
      finally:
          unlink(TESTFN)
      _can_chmod = can
      return can
  
imports: import collections.abc
  import contextlib
  import errno
  import os
  import re
  import stat
  import string
  import sys
  import time
  import unittest
  import warnings
  from test import support
label_desc: Use image node_id 6 for calling a global function with example usage: can_chmod() and returns: can, _can_chmod, _can_chmod