def attr_has_same_shape(first_obj, second_obj, attr):
    """
    Given two objects, check if the given arraylike attributes of those
    objects have the same shape. If one object has an attribute value of
    ``None``, the other must too.

    Args:
        first_obj (obj): A object with an arraylike ``attr`` attribute.
        second_obj (obj): Another object with an arraylike ``attr`` attribute.
        attr (str): The name of the attribute to test.

    Returns:
        bool: `True` if attributes are the same shape
    """
    first, second = getattr(first_obj, attr), getattr(second_obj, attr)
    if first is None or second is None:
        return first is second
    else:
        return first.shape == second.shape
