def _get_nodes_perms_key(user, parent_id=None) -> str:
    """
    Returns key (as string) used to cache a list of nodes permissions.

    Key is based on (user_id, parent_id) pair i.e we cache
    all nodes' permissions dictionary of folder.
    If parent_id == None - we will cache all root documents of given user.
    """
    uid = user.id
    pid = parent_id or ''
    nodes_perms_key = f"user_{uid}_parent_id_{pid}_readable_nodes"

    return nodes_perms_key