code: def set_mode (filename, flags):
      
      try:
          mode = os.lstat(filename).st_mode
      except OSError:
          # ignore
          return
      if not (mode & flags):
          try:
              os.chmod(filename, flags | mode)
          except OSError as msg:
              log_error("could not set mode flags for `%s': %s" % (filename, msg))
docs: Set mode flags for given filename if not already set.