def is_array(obj):
    """Return True if object implements necessary attributes to be
    considered similar to a numpy array.

    Attributes needed are "shape", "dtype", "__getitem__"
    and "__array__".

    :param obj: Array-like object (numpy array, h5py dataset...)
    :return: boolean
    """
    for attr in ('shape', 'dtype', '__array__', '__getitem__'):
        if not hasattr(obj, attr):
            return False
    return True
