def values_match(x, y):
    """ Compare x and y.  This needed because the types are unpredictable and sometimes
    a ValueError is thrown when trying to compare.
    """
    if x is y:
        return True
    # explicit checks for None used to prevent warnings like:
    # FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
    # eq = x==y

    if x is None:
        if y is None:
            return True
        else:
            return False
    if y is None:
        return False
    try:
        eq = x==y
    except ValueError:
        # ValueError: shape mismatch: objects cannot be broadcast to a single shape
        return False
    if isinstance(eq, bool):
        return eq
    return eq.all()