def METHOD_NAME(cube, coordinate='time'):
    """Calculate linear trend of data along a given coordinate.
    The linear trend is defined as the slope of an ordinary linear regression.
    Parameters
    ----------
    cube : iris.cube.Cube
        Input data.
    coordinate : str, optional (default: 'time')
        Dimensional coordinate over which the trend is calculated.
    Returns
    -------
    iris.cube.Cube
        Trends.
    Raises
    ------
    iris.exceptions.CoordinateNotFoundError
        The dimensional coordinate with the name ``coordinate`` is not found in
        ``cube``.
    """
    coord = cube.coord(coordinate, dim_coords=True)
    # Construct aggregator and calculate trend
    def call_func(data, axis, x_data):
        """Calculate trend."""
        trend_arr = np.apply_along_axis(_get_slope, axis, data, x_data)
        trend_arr = np.ma.masked_invalid(trend_arr)
        return trend_arr
    def lazy_func(data, axis, x_data):
        """Calculate trend lazily."""
        trend_arr = da.apply_along_axis(
            _get_slope, axis, data, x_data, dtype=data.dtype, shape=())
        trend_arr = da.ma.masked_invalid(trend_arr)
        return trend_arr
    aggregator = iris.analysis.Aggregator('trend', call_func,
                                          lazy_func=lazy_func,
                                          x_data=coord.points)
    cube = cube.collapsed(coord, aggregator)
    # Adapt units
    _set_trend_units(cube, coord)
    return cube