human
I wrote the below code

    if ((not ignoreImportRules) and (not isinstance(sheetOrStyle, css.CSSStyleDeclaration))):
        for importrule in (r for r in sheetOrStyle if (r.type == r.IMPORT_RULE)):
            importrule.href = replacer(importrule.href)
    def styleDeclarations(base):
        'recursive    generator    to    find    all    CSSStyleDeclarations'
        if hasattr(base, 'cssRules'):
            for rule in base.cssRules:
                for s in styleDeclarations(rule):
                    (yield s)
        elif hasattr(base, 'style'):
            (yield base.style)
        elif isinstance(sheetOrStyle, css.CSSStyleDeclaration):
            (yield base)
    for style in styleDeclarations(sheetOrStyle):
        for p in style.getProperties(all=True):
            for v in p.propertyValue:
                if (v.type == v.URI):
                    v.uri = replacer(v.uri)

What's a good function header?

=====
Can you provide a Python code to find    all    CSSStyleDeclarations'?
assistant
#Here is Python code to find    all    CSSStyleDeclarations'
.

def replaceUrls(sheetOrStyle, replacer, ignoreImportRules=False):