Pipe a block of text to urlview, which displays a list of urls
        contained in the text and allows the user to open them with their
        web browser.

def open_urlview(self, data):
        """
        Pipe a block of text to urlview, which displays a list of urls
        contained in the text and allows the user to open them with their
        web browser.
        """

        urlview = os.getenv('RTV_URLVIEWER') or 'urlview'
        command = shlex.split(urlview)
        try:
            with self.suspend():
                _logger.debug('Running command: %s', command)
                p = subprocess.Popen(command, stdin=subprocess.PIPE)
                try:
                    p.communicate(input=data.encode('utf-8'))
                except KeyboardInterrupt:
                    p.terminate()

                code = p.poll()
                if code == 1:
                    # Clear the "No URLs found." message from stdout
                    sys.stdout.write("\033[F")
                    sys.stdout.flush()

            if code == 1:
                self.show_notification('No URLs found')

        except OSError as e:
            _logger.exception(e)
            self.show_notification(
                'Failed to open {0}'.format(urlview))