def user_open(url_or_command):
from urllib.parse import urlparse<EOL>scheme = urlparse(url_or_command).scheme<EOL>if scheme == '<STR_LIT:http>' or scheme == '<STR_LIT>':<EOL><INDENT>import webbrowser<EOL>import os<EOL>savout = os.dup(<NUM_LIT:1>)<EOL>os.close(<NUM_LIT:1>)<EOL>os.open(os.devnull, os.O_RDWR)<EOL>try:<EOL><INDENT>webbrowser.open(url_or_command)<EOL><DEDENT>finally:<EOL><INDENT>os.dup2(savout, <NUM_LIT:1>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>import subprocess<EOL>subprocess.Popen(url_or_command, shell=True)<EOL><DEDENT>
Open the specified paramater in the web browser if a URL is detected,
    othewrise pass the paramater to the shell as a subprocess. This function
    is inteded to bu used in on_leftclick/on_rightclick callbacks.

    :param url_or_command: String containing URL or command