def get_sudo(cmd):
	if type(cmd) == list:
		cmd = " && ".join(cmd)

	if os.geteuid() != 0:
		if "DISPLAY" in os.environ:
			if command_exists("pkexec"):
				sudo = "pkexec sh -c"
			elif command_exists("gksu"):
				sudo = "gksu"
			elif "SSH_ASKPASS" in os.environ:
				sudo = os.environ["SSH_ASKPASS"]+" | sudo -S sh -c"
			else:
				raise Exception("Could not find graphical sudo executable")
		else:
			sudo = "sudo sh -c"
		cmd = sudo+" \""+cmd+"\""
	return cmd
dataset/ETHPy150Open emersion/bups/bups/sudo.py/get_sudo/original