Replaced re with urlparse. Changed my life.