Stack arrays using different methods.

    :param method: the combination method
    :type method: PyCObject
    :param arrays: a list of arrays
    :param masks: a list of mask arrays, True values are masked
    :param dtype: data type of the output
    :param zeros:
    :param scales:
    :param weights:
    :return: median, variance of the median and number of points stored

def generic_combine(method, arrays, masks=None, dtype=None,
                    out=None, zeros=None, scales=None, weights=None):
    """Stack arrays using different methods.

    :param method: the combination method
    :type method: PyCObject
    :param arrays: a list of arrays
    :param masks: a list of mask arrays, True values are masked
    :param dtype: data type of the output
    :param zeros:
    :param scales:
    :param weights:
    :return: median, variance of the median and number of points stored
    """

    arrays = [numpy.asarray(arr, dtype=dtype) for arr in arrays]
    if masks is not None:
        masks = [numpy.asarray(msk) for msk in masks]

    if out is None:
        # Creating out if needed
        # We need three numbers
        try:
            outshape = (3,) + tuple(arrays[0].shape)
            out = numpy.zeros(outshape, dtype)
        except AttributeError:
            raise TypeError('First element in arrays does '
                            'not have .shape attribute')
    else:
        out = numpy.asanyarray(out)

    intl_combine.generic_combine(
        method, arrays,
        out[0], out[1], out[2],
        masks, zeros, scales, weights
    )
    return out