def replaceUrls(sheetOrStyle, replacer, ignoreImportRules=False):
 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)

def replaceUrls ( sheetOrStyle , replacer , ignoreImportRules = False ) : 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 ) : 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 )
replace all urls in :class:cssutils .