def iterbytes(b):
 if isinstance(b, memoryview):
  b = b.tobytes()
 i = 0
 while True:
  a = b[i:(i + 1)]
  i += 1
  if a:
   (yield a)
  else:
   break

def iterbytes ( b ) : if isinstance ( b , memoryview ) : b = b . tobytes ( ) i = 0 while True : a = b [ i : ( i + 1 ) ] i += 1 if a : ( yield a ) else : break
iterate over bytes .