def cls_pklstr_gen(cls_pklstr):
    """A generator function for searching for a class definition
    within packages/subpackages.
    """
    yield cls_pklstr
    mod, cls = cls_pklstr.split(b'\n', 1)
    mod = mod[1:]
    while b'.' in mod:
        mod = mod.split(b'.', 1)[-1]
        yield b'c' + mod + b'\n' + cls
