examples/sys/stderr.py
from __future__ import print_function
import sys

print("hello")
sys.stderr.write("world\n")

print('spam', file=sys.stderr)

For print( ... file=sys.stderr) we need both of the above imports.