<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def urltool(classqname, filt, reverse):
 """ Dump all urls branching from a class as OpenAPI 3 documentation The class must be given as a FQPN which points to a Klein() instance. Apply optional [FILT] as a regular expression searching within urls. For example, to match all urls beginning with api, you might use '^/api' """

    filt = re.compile(filt or '.*')

    rootCls = namedAny(classqname)
    rules = list(_iterClass(rootCls))
    arr = []
    for item in sorted(rules):
        if item.subKlein:
            continue

        matched = filt.search(item.rulePath)
        matched = not matched if reverse else matched
        if matched:
            arr.append(tuple(item.toOpenAPIPath()))

    openapi3 = openapi.OpenAPI()
    for pathPath, pathItem in arr:
        if pathPath in openapi3.paths:
            openapi3.paths[pathPath].merge(pathItem)
        else:
            openapi3.paths[pathPath] = pathItem
    print(yaml.dump(openapi3, default_flow_style=False))