```
class Solution(object):
def validUtf8(self, data):
"""
:type data: List[int]
:rtype: bool
"""
suffix, bits = 0, [128, 192, 224, 240, 248]
for datum in data:
if datum >= bits[4]:
return False
if suffix:
if bits[0] <= datum < bits[1]:
suffix -= 1
else:
return False
else:
if bits[0] <= datum < bits[1]:
return False
else:
for i in range(1, 4):
if bits[i] <= datum < bits[i+1]:
suffix = i
break
return suffix == 0
```