def set_data_matrix_chunk_size(df_shape, max_chunk_kb, elem_per_kb):
    """
    Sets chunk size to use for writing data matrix. 
    Note. Calculation used here is for compatibility with cmapM and cmapR. 

    Input:
        - df_shape (tuple): shape of input data_df. 
        - max_chunk_kb (int, default=1024): The maximum number of KB a given chunk will occupy
        - elem_per_kb (int): Number of elements per kb 

    Returns:
        chunk size (tuple) to use for chunking the data matrix 
    """ 
    row_chunk_size = min(df_shape[0], 1000)
    col_chunk_size = min(((max_chunk_kb*elem_per_kb)//row_chunk_size), df_shape[1])
    return (row_chunk_size, col_chunk_size)
Sets chunk size to use for writing data matrix. 
    Note. Calculation used here is for compatibility with cmapM and cmapR. 

    Input:
        - df_shape (tuple): shape of input data_df. 
        - max_chunk_kb (int, default=1024): The maximum number of KB a given chunk will occupy
        - elem_per_kb (int): Number of elements per kb 

    Returns:
        chunk size (tuple) to use for chunking the data matrix