def METHOD_NAME(allocation_rule, files_in, files_out, net_loss, storage_method, **kwargs):
    if allocation_rule == 3:
        allocation_rule = 2
    elif allocation_rule == 0 and net_loss:
        raise NotImplementedError("net loss option is not implemented for alloc rule 0")
    if files_out is not None:
        files_out = files_out[0]
    if files_in is None:
        streams_in = [sys.stdin.buffer]
    else:
        streams_in = [open(file_in, 'rb') for file_in in files_in]
    try:
        for stream_in in streams_in:
            stream_type, max_sidx_val = read_stream_header(stream_in)
        if storage_method == "sparse":
            run_synchronous_sparse(max_sidx_val, allocation_rule, streams_in=streams_in, files_out=files_out, net_loss=net_loss, **kwargs)
        else:
            raise ValueError(f"storage_method {storage_method} is not supported for this version")
    finally:
        if files_in is not None:
            for stream_in in streams_in:
                stream_in.close()