def bytes_leading(raw_bytes, needle=ZERO_BYTE):
 leading = 0
 _byte = needle[0]
 for x in raw_bytes:
  if (x == _byte):
   leading += 1
  else:
   break
 return leading

def bytes_leading ( raw_bytes , needle = ZERO_BYTE ) : leading = 0 _byte = needle [ 0 ] for x in raw_bytes : if ( x == _byte ) : leading += 1 else : break return leading
finds the number of prefixed byte occurrences in the haystack .