code: def write(self, value):
          
          if 'w' == self._mode and isinstance(value, str):
              self._queue.put(value.encode('utf-8'))
          elif self._mode in {'w', 'wb'}:
              if isinstance(value, (bytes, bytearray)):
                  self._queue.put(value)
              else:
                  raise TypeError(
                      "a string or bytes object is required, not {}".format(
                          type(value)))
          else:
              raise IOError("File not opened in write mode.")
docs: write the given value to the stream - if the object is a bytearray,
          write it as-is - otherwise, convert the object to a string with
          `str()` and write the UTF-8 bytes
  
          :param value: the value to write
          :type value: str or bytearray
          :raises TypeError: if the type of the value provided does not match
              the mode in which the file was opened.
          :raises NotImplementedError: if the mode of the file is not one of the
          supported values (currently only "writing" modes for files are
          supported - leaving the option to implement "read" modes open for
          future work)