def mkbrowseto(self, url):
        """Create the urwid callback function to open the web browser or call
        another function with the URL.

        """
        # Try-except block to work around webbrowser module bug
        # https://bugs.python.org/issue31014
        try:
            browser = os.environ['BROWSER']
        except KeyError:
            pass
        else:
            del os.environ['BROWSER']
            webbrowser.register(browser, None, webbrowser.GenericBrowser(browser))
            try_idx = webbrowser._tryorder.index(browser)
            webbrowser._tryorder.insert(0, webbrowser._tryorder.pop(try_idx))

        def browse(*args):
            # double ()() to ensure self.search evaluated at runtime, not when
            # browse() is _created_. [0] is self.search, [1] is self.enter
            # self.enter prevents opening URL when in search mode
            if self._get_search()[0]() is True:
                if self._get_search()[1]() is True:
                    self.search = False
                    self.enter = False
            elif not self.run:
                webbrowser.open(url)
            elif self.run and self.pipe:
                process = Popen(shlex.split(self.run), stdout=PIPE, stdin=PIPE)
                process.communicate(input=url.encode(sys.getdefaultencoding()))
            else:
                Popen(self.run.format(url), shell=True).communicate()

            size = self.tui.get_cols_rows()
            self.draw_screen(size)
        return browse
Create the urwid callback function to open the web browser or call
        another function with the URL.