code: def nunpack(s, default=0):
      
      l = len(s)
      if not l:
          return default
      elif l == 1:
          return ord(s)
      elif l == 2:
          return struct.unpack('>H', s)[0]
      elif l == 3:
          return struct.unpack('>L', b'\x00'+s)[0]
      elif l == 4:
          return struct.unpack('>L', s)[0]
      else:
          raise TypeError('invalid length: %d' % l)
docs: Unpacks 1 to 4 byte integers (big endian).