import re


def fixSlashes(url):
    """
    Removes double slashes in URLs, and ensures the protocol is doubleslahed
    """
    # insert missing protocol slashes
    p = re.compile( '(:/)([^/])' )
    url = p.subn( r'\1/\2', url)[0]
    
    # strip any double slashes excluding ://
    p = re.compile( '([^:])//' )
    return p.subn( r'\1/', url)[0]