<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def network_info(name=None, **kwargs):
    '''
    Return informations on a virtual network provided its name.

    :param name: virtual network name
    :param connection: libvirt connection URI, overriding defaults
    :param username: username to connect with, overriding defaults
    :param password: password to connect with, overriding defaults

    If no name is provided, return the infos for all defined virtual networks.

    .. versionadded:: 2019.2.0

    CLI Example:

    .. code-block:: bash

        salt '*' virt.network_info default
    '''
    result = {}
    conn = __get_conn(**kwargs)

    def _net_get_leases(net):
        '''
        Get all DHCP leases for a network
        '''
        leases = net.DHCPLeases()
        for lease in leases:
            if lease['type'] == libvirt.VIR_IP_ADDR_TYPE_IPV4:
                lease['type'] = 'ipv4'
            elif lease['type'] == libvirt.VIR_IP_ADDR_TYPE_IPV6:
                lease['type'] = 'ipv6'
            else:
                lease['type'] = 'unknown'
        return leases

    try:
        nets = [net for net in conn.listAllNetworks() if name is None or net.name() == name]
        result = {net.name(): {
                       'uuid': net.UUIDString(),
                       'bridge': net.bridgeName(),
                       'autostart': net.autostart(),
                       'active': net.isActive(),
                       'persistent': net.isPersistent(),
                       'leases': _net_get_leases(net)} for net in nets}
    except libvirt.libvirtError as err:
        log.debug('Silenced libvirt error: %s', str(err))
    finally:
        conn.close()
    return result