'Generates an inverse `Model` for this `_CompoundModel` when either
model in the operation has a *custom inverse* that was manually
assigned by the user.
If either model has a custom inverse, and in particular if another
`_CompoundModel` has a custom inverse, then none of that model\'s
sub-models should be considered at all when computing the inverse.
So in that case we just compute the inverse ahead of time and set
it as the new compound model\'s custom inverse.
Note, this use case only applies when combining model instances,
since model classes don\'t currently have a notion of a "custom
inverse" (though it could probably be supported by overriding the
class\'s inverse property).
TODO: Consider fixing things so the aforementioned class-based case
works as well.  However, for the present purposes this is good enough.'

@classmethod
def _make_user_inverse(mcls, operator, left, right):

    if (not ((operator in (u'&', u'|')) and (left._user_inverse or right._user_inverse))):
        return None
    try:
        left_inv = left.inverse
        right_inv = right.inverse
    except NotImplementedError:
        return None
    if (operator == u'&'):
        return (left_inv & right_inv)
    else:
        return (right_inv | left_inv)
