def METHOD_NAME(path, target, ordering):
    def capture(file_list, dirname, files):
        suffix = os.path.split(dirname)[1]
        if 'lib' in suffix or suffix == 'tests' \
                or suffix == 'mitsuba' or suffix == 'utils' \
                or suffix == 'converter':
            return
        for filename in files:
            if '.cpp' == os.path.splitext(filename)[1]:
                fname = os.path.join(dirname, filename)
                file_list += [fname]
    file_list = []
    for (dirname, _, files) in os.walk(path):
        capture(file_list, dirname, files)
    for o in ordering:
        if o.endswith('.py'):
            file_list.append(o)
    ordering = [(find_order_id(fname, ordering), fname) for fname in file_list]
    ordering = sorted(ordering, key=lambda entry: entry[0])
    for entry in ordering:
        if entry[1].endswith('.py'):
            extract_python(target, entry[1])
        else:
            extract(target, entry[1])