code: def _read_fd(file_descr):
          try:
              line = os.read(file_descr, 1024 * 1024)
          except OSError:
              stream_desc = NonBlockingStreamReader._get_sd(file_descr)
              if stream_desc is not None:
                  stream_desc.has_error = True
                  if stream_desc.callback is not None:
                      stream_desc.callback()
              return 0
          if line:
              stream_desc = NonBlockingStreamReader._get_sd(file_descr)
              if stream_desc is None:
                  return 0
              if IS_PYTHON3:
                  try:
                      line = line.decode("ascii")
                  except UnicodeDecodeError:
                      line = repr(line)
              stream_desc.buf += line
              split = stream_desc.buf.split(os.linesep)
              for line in split[:-1]:
                  stream_desc.read_queue.appendleft(strip_escape(line.strip()))
                  if stream_desc.callback is not None:
                      stream_desc.callback()
              stream_desc.buf = split[-1]
              return len(line)
          return 0