code: def is_good_temp_dir(path):
      
      if not os.path.exists(path):
          try:
              os.makedirs(path, mode=int('0700', 8))
          except OSError:
              e = sys.exc_info()[1]
              LOG.debug('temp dir %r unusable: did not exist and attempting '
                        'to create it failed: %s', path, e)
              return False
  
      try:
          tmp = tempfile.NamedTemporaryFile(
              prefix='ansible_mitogen_is_good_temp_dir',
              dir=path,
          )
      except (OSError, IOError):
          e = sys.exc_info()[1]
          LOG.debug('temp dir %r unusable: %s', path, e)
          return False
  
      try:
          try:
              os.chmod(tmp.name, int('0700', 8))
          except OSError:
              e = sys.exc_info()[1]
              LOG.debug('temp dir %r unusable: chmod failed: %s', path, e)
              return False
  
          try:
              # access(.., X_OK) is sufficient to detect noexec.
              if not os.access(tmp.name, os.X_OK):
                  raise OSError('filesystem appears to be mounted noexec')
          except OSError:
              e = sys.exc_info()[1]
              LOG.debug('temp dir %r unusable: %s', path, e)
              return False
      finally:
          tmp.close()
  
      return True
docs: Return :data:`True` if `path` can be used as a temporary directory, logging
      any failures that may cause it to be unsuitable. If the directory doesn't
      exist, we attempt to create it using :func:`os.makedirs`.