def process_css(css_source, tabid, base_uri):
 def _absolutize_css_import(match):
  return '@import "{}"'.format(wrap_url(match.group(1), tabid, base_uri).replace('"', '%22'))
 def _absolutize_css_url(match):
  url = match.group(1).strip('"\'')
  return 'url("{}")'.format(wrap_url(url, tabid, base_uri).replace('"', '%22'))
 css_source = CSS_IMPORT.sub(_absolutize_css_import, css_source)
 css_source = CSS_URL.sub(_absolutize_css_url, css_source)
 css_source = BAD_CSS.sub('portia-blocked', css_source)
 return css_source

def process_css ( css_source , tabid , base_uri ) : def _absolutize_css_import ( match ) : return '@import "{}"' . format ( wrap_url ( match . group ( 1 ) , tabid , base_uri ) . replace ( '"' , '%22' ) ) def _absolutize_css_url ( match ) : url = match . group ( 1 ) . strip ( '"\'' ) return 'url("{}")' . format ( wrap_url ( url , tabid , base_uri ) . replace ( '"' , '%22' ) ) css_source = CSS_IMPORT . sub ( _absolutize_css_import , css_source ) css_source = CSS_URL . sub ( _absolutize_css_url , css_source ) css_source = BAD_CSS . sub ( 'portia-blocked' , css_source ) return css_source
wraps urls in css source .