def url_prefix(mat):
 return ('/' + mat.string[:mat.start()].strip('/'))

def url_prefix ( mat ) : return ( '/' + mat . string [ : mat . start ( ) ] . strip ( '/' ) )
extract the url prefix from a regex match .