Fix Python – Identify groups of continuous numbers in a list

I’d like to identify groups of continuous numbers in a list, so that:
myfunc([2, 3, 4, 5, 12, 13, 14, 15, 16, 17, 20])

Returns:
[(2,5), (12,17), 20]

And was wondering what the best way to do this was (particularly if there’s something inbuilt into Python).
Edit: Note I originally forgot to mention that individual numbers should be returned as in….

Fix Python – NameError: global name ‘xrange’ is not defined in Python 3

I am getting an error when running a python program:
Traceback (most recent call last):
File “C:\Program Files (x86)\Wing IDE 101 4.1\src\debug\tserver\_sandbox.py”, line 110, in
File “C:\Program Files (x86)\Wing IDE 101 4.1\src\debug\tserver\_sandbox.py”, line 27, in __init__
File “C:\Program Files (x86)\Wing IDE 101 4.1\src\debug\….