def METHOD_NAME():
    import _pyio as pyio  # Python implementation.
    file_name = "dump.txt"
    unlink(file_name)
    try:
        # verify weak references
        from array import array
        from weakref import proxy
        from collections import UserList
        f = pyio.open(file_name, "wb")
        p = proxy(f)
        p.write(b'teststring')
        assert f.tell() == p.tell()
        f.close()
        f = None
        # TODO: since weakref is not yet properly implemented this will not work
        # assert_raises(ReferenceError, getattr, p, 'tell')
        # verify expected attributes exist
        f = pyio.open(file_name, "wb")
        f.name     # merely shouldn't blow up
        f.mode     # ditto
        f.closed   # ditto
        f.close()
        # verify writelines with instance sequence
        f = pyio.open(file_name, "wb")
        l = UserList([b'1', b'2'])
        f.writelines(l)
        f.close()
        f = pyio.open(file_name, 'rb')
        buf = f.read()
        assert buf == b'12'
        f.close()
        # verify writelines with integers
        f = pyio.open(file_name, "wb")
        assert_raises(TypeError, f.writelines, [1, 2, 3])
        f.close()
        # verify writelines with integers in UserList
        f = pyio.open(file_name, "wb")
        l = UserList([1,2,3])
        assert_raises(TypeError, f.writelines, l)
        f.close()
        # verify writelines with non-string object
        class NonString:
            pass
        f = pyio.open(file_name, "wb")
        assert_raises(TypeError, f.writelines, [NonString(), NonString()])
        f.close()
        f = pyio.open(file_name, "wb")
        assert f.name == file_name
        assert not f.isatty()
        assert not f.closed
        f.close()
        assert f.closed
    finally:
        unlink(file_name)