def METHOD_NAME(context, user, directory):
    context.update({
        "opt_object": directory,
        "user": user,
        "is_member_of_directory": directory.has_membership_with(user)
    })
    return context