code: def splitquery(url):
      
      global _queryprog
      if _queryprog is None:
          import re
          _queryprog = re.compile('^(.*)\?([^?]*)$')
  
      match = _queryprog.match(url)
      if match: return match.group(1, 2)
      return url, None
docs: splitquery('/path?query') --> '/path', 'query'.