windows: handle file-like objects without isatty() method
Copying the function is not nice, but moving around stuff to avoid the
circular import didn’t seem to be worth the effort.
public attribute not declared in interfaces: badpeer.badattributepublic attribute not declared in interfaces: badpeer.badmethod