Get current wifi ssid in Python

As with a lot of the posts here. Just at quick note to make sure I can find the information again.

Print the current wlan ssid i python, running raspbian (or other linux OS’es):

import subprocess
ssid = subprocess.check_output("iwgetid -r", shell=True)
print(ssid)