code: def group_consecutives(data, stepsize=1):
      
      run = []
      result = [run]
      expect = None
      for item in data:
          if (item == expect) or (expect is None):
              run.append(item)
          else:
              run = [item]
              result.append(run)
          expect = item + stepsize
      return result
docs: Return list of consecutive lists of numbers from data (number list).
  
      References:
          http://stackoverflow.com/questions/7352684/how-to-find-the-groups-of-consecutive-elements-from-an-array-in-numpy