def METHOD_NAME(self, grid, origins, sizes):
    return CIS('generalGrid', *([
            self.encode_regular_axis(axis, origin, size)
            if axis.regular else
            self.encode_irregular_axis(axis)
            for axis, origin, size in izip_longest(grid, origins, sizes)
        ] + [
            CIS('gridLimits', *[
                CIS(
                    'indexAxis',
                    axisLabel=label,
                    lowerBound="0",
                    upperBound=str(size),
                ) for label, size in zip('ijkl', sizes)
            ])
        ]),
        srsName=grid.coordinate_reference_system,
        axisLabels=' '.join(axis.name for axis in grid)
    )