def METHOD_NAME(direction, amount=1, stream=sys.stdout, erase=False):
    """Move the cursor.
    If the stream is a TTY, print characters that will move the cursor
    in the given direction and optionally erase the line. Else do nothing.
    direction (int): the direction as a directions constant, like
        directions.UP.
    stream (fileobj): a file-like object (that adheres to the API
        declared in the `io' package). Defaults to sys.stdout.
    erase (bool): True if the line the cursor ends on should be erased.
    """
    if stream.isatty():
        if direction == directions.UP:
            print(curses.tparm(curses.tigetstr("cuu"), amount).decode('ascii'),
                  file=stream, end='')
        elif direction == directions.DOWN:
            print(curses.tparm(curses.tigetstr("cud"), amount).decode('ascii'),
                  file=stream, end='')
        elif direction == directions.LEFT:
            print(curses.tparm(curses.tigetstr("cub"), amount).decode('ascii'),
                  file=stream, end='')
        elif direction == directions.RIGHT:
            print(curses.tparm(curses.tigetstr("cuf"), amount).decode('ascii'),
                  file=stream, end='')
        if erase:
            print(curses.tparm(curses.tigetstr("el")).decode('ascii'),
                  file=stream, end='')
        stream.flush()