import numbers


def verify_shape(value, shape):
    """
    Checks that `value` fulfills the shape specification given by `shape`.
    """
    if shape == -1:
        return True
    else:
        # ensure tuple
        if isinstance(shape, numbers.Integral):
            shape = (shape,)

        # special case for scalar
        if value.shape == () and shape == (1,):
            return True

        return value.shape == shape