def parse(url):
    '''
    Parse a salt:// URL; return the path and a possible saltenv query.
    '''
    if not url.startswith('salt://'):
        return url, None

    # urlparse will split on valid filename chars such as '?' and '&'
    resource = url.split('salt://', 1)[-1]

    if '?env=' in resource:
        # "env" is not supported; Use "saltenv".
        path, saltenv = resource.split('?env=', 1)[0], None
    elif '?saltenv=' in resource:
        path, saltenv = resource.split('?saltenv=', 1)
    else:
        path, saltenv = resource, None

    if salt.utils.platform.is_windows():
        path = salt.utils.path.sanitize_win_path(path)

    return path, saltenv