<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def decode(data):
        "Decodes a syncsafe integer"
        value = 0
        for b in data:
            if b > 127:  # iTunes bug
                raise ValueError("Invalid syncsafe integer")
            value <<= 7
            value += b
        return value