docs: def parse_query(query, delim='/'):
          """
          Parse a boto query
          """
          key = ''
          prefix = ''
          postfix = ''
  
          parsed = urlparse(query)
          query = parsed.path.lstrip(delim)
          bucket = parsed.netloc
  
          if not parsed.scheme.lower() in ('', "gs", "s3", "s3n"):
              raise ValueError("Query scheme must be one of '', 'gs', 's3', or 's3n'; "
                               "got: '%s'" % parsed.scheme)
          storage = parsed.scheme.lower()
  
          if not bucket.strip() and query:
              toks = query.split(delim, 1)
              bucket = toks[0]
              if len(toks) == 2:
                  key = toks[1]
              else:
                  key = ''
  
          if not bucket.strip():
              raise ValueError("Could not parse bucket name from query string '%s'" % query)
  
          tokens = query.split("*")
          n = len(tokens)
          if n == 0:
              pass
          elif n == 1:
              key = tokens[0]
          elif n == 2:
              index = tokens[0].rfind(delim)
              if index >= 0:
                  key = tokens[0][:(index + 1)]
                  prefix = tokens[0][(index + 1):] if len(tokens[0]) > (index + 1) else ''
              else:
                  prefix = tokens[0]
              postfix = tokens[1]
          else:
              raise ValueError("Only one wildcard ('*') allowed in query string, got: '%s'" % query)
  
          return storage, bucket, key, prefix, postfix