@contextmanager<EOL><INDENT>def location(self, x=None, y=None):<DEDENT>
stream = self._stream<EOL>stream.write(self.save_pos)  <EOL>if x is not None and y is not None:<EOL><INDENT>stream.write(self.mv(y, x))<EOL><DEDENT>elif x is not None:<EOL><INDENT>stream.write(self.mv_x(x))<EOL><DEDENT>elif y is not None:<EOL><INDENT>stream.write(self.mv_y(y))<EOL><DEDENT>stream.flush()<EOL>try:<EOL><INDENT>yield self<EOL><DEDENT>finally:<EOL><INDENT>stream.write(self.rest_pos)<EOL>stream.flush()<EOL><DEDENT>
Temporarily move the cursor, perform work, and return to the
            previous location.

            ::

                with screen.location(40, 20):
                    print('Hello, world!')