 write because
their signatures will vary, implementations and clients should
consider those methods part of the interface. Also, implementations
may raise an IOError when operations they do not support are called.

The basic type used for binary data read from or written to a file is
the bytes type. Method arguments may also be bytearray or memoryview
of arrays of bytes. In some cases, such as readinto, a writable
object such as bytearray is required. Text I/O classes work with
unicode data.

Note that calling any method (except additional calls to close(),
which are ignored) on a closed stream should raise a ValueError.

IOBase (and its subclasses) support the iterator protocol, meaning
that an IOBase object can be iterated over yielding the lines in a
stream.

IOBase also supports the :keyword:`with` statement. In this example,
fp is closed after the suite of the with statement is complete:

with open('spam.txt', 'r') as fp:
    fp.write('Spam and eggs!')
