this should also recursively call itself for any child cases (reverse indices). i think it's as simple as adding one more condition:
`return (user_is_owner or case_is_shared or any([user_can_access_case(user, subcase) for subcase in case.get_subcases()]))