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')

def parse_dburl(dburl):
    """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')
    """
    res = urlparse.urlparse(dburl)

    if '@' in res.netloc:
        (creds, host) = res.netloc.split('@')
    else:
        creds = ':'
        host = res.netloc

    (user, password) = creds.split(':')
    return (res.scheme, user, password, host, res.path[1:])