code: def write_line(self, line=None, *args, **kwargs):
          
          if line is None:
              # Empty line
              self.write("\n")
          else:
              # Format the line, if arguments have been given
              if args or kwargs:
                  line = line.format(*args, **kwargs)
  
              with self.__lock:
                  # Write it
                  self.write(line)
                  try:
                      if line[-1] != "\n":
                          # Add the trailing new line
                          self.write("\n")
                  except IndexError:
                      # Got an empty string
                      self.write("\n")
  
          self.flush()
docs: Formats and writes a line to the output