def parse_database_url(url):
if url == "<STR_LIT>":<EOL><INDENT>raise Exception(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>)<EOL><DEDENT>url_parts = urlsplit(url)<EOL>engine = get_engine(url_parts.scheme)<EOL>database, schema = parse_path(url_parts.path)<EOL>port = url_parts.port<EOL>host = url_parts.hostname<EOL>user = url_parts.username<EOL>password = url_parts.password<EOL>params = {key: val.pop() for key, val in parse_qs(url_parts.query).items()}<EOL>return DatabaseInfo(<EOL>engine=engine,<EOL>name=database,<EOL>schema=schema,<EOL>user=user,<EOL>password=password,<EOL>host=host,<EOL>port=port,<EOL>params=params,<EOL>)<EOL>
Parse a database URL and return a DatabaseInfo named tuple.

:param url: Database URL
:return: DatabaseInfo instance

Example:
>>> conf = parse_database_url(
...     'pgsql://joar:hunter2@5monkeys.se:4242/tweets/tweetschema'
...     '?hello=world')
>>> conf  # doctest: +NORMALIZE_WHITESPACE
DatabaseInfo(engine='django.db.backends.postgresql_psycopg2',
             name='tweets',
             schema='tweetschema',
             user='joar',
             password='hunter2',
             host='5monkeys.se',
             port=4242,
             params={'hello': 'world'})