import functools


def _numel(arr):
    """ Returns the number of elements for an array using a numpy-like
        interface. """
    return functools.reduce(lambda a, b: int(a) * int(b), arr.shape, 1)