code: def _safe_readinto(self, b):
          
          total_bytes = 0
          mvb = memoryview(b)
          while total_bytes < len(b):
              if MAXAMOUNT < len(mvb):
                  temp_mvb = mvb[0:MAXAMOUNT]
                  n = self.fp.readinto(temp_mvb)
              else:
                  n = self.fp.readinto(mvb)
              if not n:
                  raise IncompleteRead(bytes(mvb[0:total_bytes]), len(b))
              mvb = mvb[n:]
              total_bytes += n
          return total_bytes
docs: Same as _safe_read, but for reading into a buffer.