'helper for :func:`~matplotlib.pyplot.gci`;
do not use elsewhere.'

def _gci(self):

    cax = self._axstack.current_key_axes()[1]
    if (cax is None):
        return None
    im = cax._gci()
    if (im is not None):
        return im
    for ax in reversed(self.axes):
        im = ax._gci()
        if (im is not None):
            return im
    return None
