def METHOD_NAME(datacube, N_frames, width, side="start"):
    """
    Gets background streaking, by finding the average of a strip of pixels along the
    x-edge of the detector over a random selection of diffraction patterns.
    See docstring for get_background_streaks_1D() for more info.
    """
    assert (
        N_frames <= datacube.R_Nx * datacube.R_Ny
    ), "N_frames must be less than or equal to the total number of diffraction patterns."
    assert (side == "start") or (side == "end"), "side must be 'start' or 'end'."
    # Get random subset of DPs
    indices = np.arange(datacube.R_Nx * datacube.R_Ny)
    np.random.shuffle(indices)
    indices = indices[:N_frames]
    indices_x, indices_y = np.unravel_index(indices, (datacube.R_Nx, datacube.R_Ny))
    # Make a reference strip array
    refstrip = np.zeros((datacube.Q_Nx, width))
    if side == "start":
        for i in range(N_frames):
            refstrip += datacube.data[indices_x[i], indices_y[i], :, :width].astype(
                float
            )
    else:
        for i in range(N_frames):
            refstrip += datacube.data[indices_x[i], indices_y[i], :, -width:].astype(
                float
            )
    # Calculate mean and return 1D array of streaks
    bkgrnd_streaks = np.sum(refstrip, axis=1) // width // N_frames
    # Broadcast to 2D array
    darkref = np.zeros((datacube.Q_Nx, datacube.Q_Ny))
    darkref += bkgrnd_streaks[:, np.newaxis]
    return darkref