def fetch_ini(uri, section='', key='', fallback=None):
    import configparser, io, urllib.request

    with urllib.request.urlopen(uri) as response:
        data = response.read().decode('utf-8')

    config = configparser.ConfigParser()
    config.read_file(io.StringIO(data))

    yield valentina.TableHeader([
        ('section' , str),
        ('key'     , str),
        ('value'   , str)])

    if section:
        if key:
            yield section, key, config.get(section, key, fallback=fallback)
        else:
            for key, value in config.items(section):
                yield section, key, value
    else:
        for section in config.sections():
            for key, value in config.items(section):
                yield section, key, value

def valentina_extension_init(db):
    valentina.create_procedure('fetch_ini', fetch_ini)
