'Ensure that user and group IDs are backed by the same backend.
Raise a CrossBackendNotAllowed exception if they are not from the same
backend, otherwise return None.'

def _assert_user_and_group_in_same_backend(self, user_entity_id, user_driver, group_entity_id, group_driver):

    if (user_driver is not group_driver):
        user_driver.get_user(user_entity_id)
        group_driver.get_group(group_entity_id)
        raise exception.CrossBackendNotAllowed(group_id=group_entity_id, user_id=user_entity_id)
