def guess_kernel(chroot='', regexp=None):
    kernel = utils.guess_filename(
        path=os.path.join(chroot, 'boot'),
        regexp=(regexp or r'^vmlinuz.*'))

    if kernel:
        return kernel

    raise errors.GrubUtilsError('Error while trying to find kernel: '
                                'regexp=%s' % regexp)
Tries to guess kernel by regexp
dataset/ETHPy150Open openstack/bareon/bareon/utils/grub.py/guess_kernel