def mean(a, axis=None):
    if a.mask is numpy.ma.nomask:
        return super(numpy.ma.MaskedArray, a).mean(axis=axis)
counts = numpy.logical_not(a.mask).sum(axis=axis)
`numpy.mean` used with a tuple as `axis` argument: not working with a masked array