def get_jdbc_url(connection) -> str:
    """given a connection dictionary, retrieve the fully qualified jdbc url

    Parameters:
        connection (dict): contains keys for type, subtype, host, port

    Returns:
        str: jdbc url

    """
    if connection['subtype'] == 'sqlite':
        return f"{connection['type']}:{connection['subtype']}:{connection.get('database')}"
    else:
        return f"{connection['type']}:{connection['subtype']}://{connection.get('host')}:{connection.get('port')}"