docs: def _detect_buffer_encoding(self, f):
          """Guess by checking BOM, and checking `_special_encode_check`, and using memory map."""
  
          encoding = None
          with contextlib.closing(mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)) as m:
              encoding = self._analyze_file(m)
          return encoding