code: def stat_mode_to_index_mode(mode):
      
      if S_ISLNK(mode):   # symlinks
          return S_IFLNK
      if S_ISDIR(mode) or S_IFMT(mode) == S_IFGITLINK:    # submodules
          return S_IFGITLINK
      return S_IFREG | 0o644 | (mode & 0o111)
docs: Convert the given mode from a stat call to the corresponding index mode
      and return it