def get_pyramid_levels(conn, image_id, across_groups=True):
    """Get number of pyramid levels associated with an Image

    Parameters
    ----------
    conn : ``omero.gateway.BlitzGateway`` object
        OMERO connection.
    image_id : int
        ID of ``Image``.
    across_groups : bool, optional
        Defines cross-group behavior of function - set to
        ``False`` to disable it.

    Returns
    -------
    levels : list of tuples
        Pyramidal levels available for this image, with number of
        pixels for X and Y axes.

    Examples
    --------
    # Return pyramid levels associated to an image:

    >>> lvls = get_pyramid_levels(conn, 42)
    [(2048, 1600), (1024, 800), (512, 400), (256, 200)]

    """
    image = conn.getObject("image", image_id)
    pix = image._conn.c.sf.createRawPixelsStore()
    pid = image.getPixelsId()
    pix.setPixelsId(pid, False)
    levels = [(r.sizeX, r.sizeY) for r in pix.getResolutionDescriptions()]
    pix.close()
    return levels