def METHOD_NAME(mtz_by_spacegroup, sample_rate, dmin, grid_size):
    """
    Test DataSet.to_reciprocal_grid() when invoked with different methods for specifying
    grid size. If explicitly provided, `grid_size` should supersede `sample_rate` and `dmin`
    """
    dataset = rs.read_mtz(mtz_by_spacegroup)
    reciprocal_grid = dataset.to_reciprocal_grid(
        "FMODEL", sample_rate=sample_rate, dmin=dmin, grid_size=grid_size
    )
    if grid_size is None:
        expected = dataset.get_reciprocal_grid_size(dmin=dmin, sample_rate=sample_rate)
        assert reciprocal_grid.shape == tuple(expected)
    else:
        assert reciprocal_grid.shape == tuple(grid_size)