function reg_to_json(reg) {
    let chunk = [],
        json = [];

    for (const key of reg.keys()) {
        json.push(key);
        if (json.length === chunk_size_reg) {
            chunk.push(json);
            json = [];
        }
    }
    json.length && chunk.push(json);
    return chunk;
}
@param {
  Set<string|number>|
  Map<Array<string|number>>|
  KeystoreSet<string|number>|
  KeystoreMap<Array<string|number>>
} reg
@return {Array<Array<string|number>>}