def METHOD_NAME(img, stain_matrix):
    """Estimate concentration matrix given an image and stain matrix.
    Args:
        img (:class:`numpy.ndarray`):
            Input image.
        stain_matrix (:class:`numpy.ndarray`):
            Stain matrix for haematoxylin and eosin stains.
    Returns:
        numpy.ndarray:
            Stain concentrations of input image.
    """
    OD = rgb2od(img).reshape((-1, 3))
    x, _, _, _ = np.linalg.lstsq(stain_matrix.T, OD.T, rcond=-1)
    return x.T