<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def n_elements(self):
 """ Total number of array elements. If array is multidimensional, array is flattened. Returns 1 if not an array. """

        if self.is_array:
            return functools.reduce(operator.mul, self.array_dimensions)
        else:
            return 1