code: def decodekey(self, key):
          
          if key[:1] in (b'n', b'N', b'$'):
              if key[1:2] == b"\x00" and len(key) == 2 + self.wordsize:
                  return struct.unpack(">sB" + self.fmt, key)
              else:
                  return key[:1], key[1:].decode('utf-8', 'ignore')
          if key[:1] == b'-':
              return struct.unpack(">s" + self.fmt, key)
          if len(key) == 1 + self.wordsize:
              return struct.unpack(self.keyfmt[:3], key)
          if len(key) == 1 + self.wordsize + 1:
              return struct.unpack(self.keyfmt[:4], key)
          if len(key) == 1 + 2 * self.wordsize + 1:
              return struct.unpack(self.keyfmt[:5], key)
          if len(key) > 1 + self.wordsize + 1:
              f = struct.unpack_from(self.keyfmt[:4], key)
              return f + (key[2 + self.wordsize:], )
          raise Exception("unknown key format")
docs: splits a key in a tuple, one of:
             ( [ 'N', 'n', '$' ],  0,   bignameid )
             ( [ 'N', 'n', '$' ],  name  )
             ( '-',  id )
             ( '.',  id )
             ( '.',  id,  tag )
             ( '.',  id,  tag, value )
             ( '.',  id,  'H', name  )