Ensure that the two bounds either are an exact match, or one of them is None.

def _assert_type_bounds_are_not_conflicting(current_type_bound, previous_type_bound,
                                            location, match_query):
    """Ensure that the two bounds either are an exact match, or one of them is None."""
    if all((current_type_bound is not None,
            previous_type_bound is not None,
            current_type_bound != previous_type_bound)):
        raise AssertionError(
            u'Conflicting type bounds calculated at location {}: {} vs {} '
            u'for query {}'.format(location, previous_type_bound, current_type_bound, match_query))