def parse_dburl(dburl):
res = urllib.parse.urlparse(dburl)<EOL>if '<STR_LIT:@>' in res.netloc:<EOL><INDENT>(creds, host) = res.netloc.split('<STR_LIT:@>')<EOL><DEDENT>else:<EOL><INDENT>creds = '<STR_LIT::>'<EOL>host = res.netloc<EOL><DEDENT>(user, password) = creds.split('<STR_LIT::>')<EOL>return (res.scheme, user, password, host, res.path[<NUM_LIT:1>:])<EOL>
Parse DB URL. Return (scheme, user, password, host, dbname)
    pg://user:pass@host/dbname

    >>> parse_dburl("pg://user:pass@host/name")
    ('pg', 'user', 'pass', 'host', 'name')
    >>> parse_dburl("dbm:///dbfile")
    ('dbm', '', '', '', 'dbfile')
    >>> parse_dburl("pg://user:@/name")
    ('pg', 'user', '', '', 'name')