def dburl2dict(url):
 parts = urlparse.urlparse(unquote(url))
 return {'dbn': parts.scheme, 'user': parts.username, 'pw': parts.password, 'db': parts.path[1:], 'host': parts.hostname, 'port': parts.port}

def dburl2dict ( url ) : parts = urlparse . urlparse ( unquote ( url ) ) return { 'dbn' : parts . scheme , 'user' : parts . username , 'pw' : parts . password , 'db' : parts . path [ 1 : ] , 'host' : parts . hostname , 'port' : parts . port }
takes a url to a database and parses it into an equivalent dictionary .