import re


def _find_children(klog_filp):
    """
    Finds all record groups spawned from a klog

    @klog_filp the file of the klog (python file object, not string)
    @returns a list of integers, containing group_ids
    """
    ret = []
    for line in klog_filp.readlines():
        match = re.match("\tnew group id: ([0-9]+)", line)
        if match is not None:
            #print "\t\talso scanning child with id: " + match.group(1)
            ret.append(int(match.group(1)))

    return ret