Preview:
add this to top of bash script
[ "$UID" -eq 0 ] || exec sudo "$0" "$@"

in python it becomes
if os.geteuid() != 0:
    os.execvp("sudo", ["sudo", sys.executable] + sys.argv)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter