code: def chmod(target):
      
      assert isinstance(target, str)
      assert os.path.exists(target)
  
      file_mode = stat.S_IRUSR | stat.S_IWUSR
      folder_mode = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
  
      # Remove the immutable attribute recursively if there is one
      remove_immutable_attribute(target)
  
      if os.path.isfile(target):
          os.chmod(target, file_mode)
  
      elif os.path.isdir(target):
          # chmod the root item
          os.chmod(target, folder_mode)
  
          # chmod recursively in the folder it it's one
          for root, dirs, files in os.walk(target):
              for cur_dir in dirs:
                  os.chmod(os.path.join(root, cur_dir), folder_mode)
              for cur_file in files:
                  os.chmod(os.path.join(root, cur_file), file_mode)
  
      else:
          raise ValueError("Unsupported file type: {}".format(target))
docs: Recursively set the chmod for files to 0600 and 0700 for folders.
  
      It's ok unless we need something more specific.
  
      Args:
          target (str): Root file or folder