What is data? An ndarray? If so, if you have a lenght 8 vector, you can index past it like this:

l[4:10]

This will return l[4:] in this parce. So why do you need the if line line 816? I think you can remove that if/else and just use line 819.