def ex_list_networks(self, project=None):
        """
        List the available networks

        :param  project: Optional project the networks belongs to.
        :type   project: :class:`.CloudStackProject`

        :rtype ``list`` of :class:`CloudStackNetwork`
        """

        args = {}

        if project is not None:
            args['projectid'] = project.id

        res = self._sync_request(command='listNetworks',
                                 params=args,
                                 method='GET')
        nets = res.get('network', [])

        networks = []
        extra_map = RESOURCE_EXTRA_ATTRIBUTES_MAP['network']
        for net in nets:
            extra = self._get_extra_dict(net, extra_map)

            if 'tags' in net:
                extra['tags'] = self._get_resource_tags(net['tags'])

            networks.append(CloudStackNetwork(
                            net['displaytext'],
                            net['name'],
                            net['networkofferingid'],
                            net['id'],
                            net['zoneid'],
                            self,
                            extra=extra))

        return networks
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/cloudstack.py/CloudStackNodeDriver.ex_list_networks/original