def group_documents_by_pointers(documents):
    """
    Groups a list of documents by their number of pointers
    Args:
        documents(list(metadata.MetaDocument)): MetaDocuments to group
    Returns:
        dict(int, list(metadata.MetaDocument)): MetaDocuments grouped by number of pointers
    """
    if not isinstance(documents, list):
        raise ValueError("documents argument must be a list")
    groups = {}
    for doc in documents:
        number_of_pointers = len(doc.entangling_blocks)
        group = groups.get(number_of_pointers, [])
        group.append(doc)
        groups[number_of_pointers] = group
    return groups