def extract_from_url(url):
    """ Extracts information from a URL  and fills the passed kwargs dict
    with the key values extracted.

    Reference: http://docs.sqlalchemy.org/en/latest/core/engines.html

    :param str url:
    :return: key/value pairs for:
        'db_engine', 'db_host', 'db_port', 'db_usr', 'db_pwd'
    :rtype: dict
    """
    kwargs = {}
    protocol, rest = url.split('://', 1)
    kwargs['db_engine'] = protocol
    if '/' in rest:
        rest, kwargs['db_name'] = rest.split('/', 1)
    if '@' in rest:
        uid_pwd, host = rest.split('@')
        kwargs['db_usr'], kwargs['db_pwd'] = uid_pwd.split(':')
    else:
        host = rest
    if ':' in host:
        kwargs['db_host'], kwargs['db_port'] = host.split(':', 1)
    elif host:
        kwargs['db_host'], kwargs['db_port'] = host, '0'
    return kwargs
