def split_url_and_query(url):
    """Split the query from the url"""
    try:
        index = url.index('?')
    except ValueError:
        return url, ''
    query = url[index + 1:]
    url = url[:index]
    return url, query
