def extract_num(buf, start, length):
 val = 0
 for i in range(start, (start + length)):
  val <<= 8
  val += ord(buf[i])
 return val

def extract_num ( buf , start , length ) : val = 0 for i in range ( start , ( start + length ) ) : val <<= 8 val += ord ( buf [ i ] ) return val
extracts a number from a raw byte string .