<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect_networks(self, action, container_name, endpoints, skip_first=False, **kwargs):
 """ Connects a container to a set of configured networks. By default this assumes the container has just been created, so it will skip the first network that is already considered during creation. :param action: Action configuration. :type action: dockermap.map.runner.ActionConfig :param container_name: Container names or id. :type container_name: unicode | str :param endpoints: Network endpoint configurations. :type endpoints: list[dockermap.map.input.NetworkEndpoint] :param skip_first: Skip the first network passed in ``endpoints``. Defaults to ``False``, but should be set to ``True`` when the container has just been created and the first network has been set up there. :type skip_first: bool :param kwargs: Additional keyword arguments to complement or override the configuration-based values. :type kwargs: dict """

        if not endpoints or (skip_first and len(endpoints) <= 1):
            return
        client = action.client
        map_name = action.config_id.map_name
        nname = self._policy.nname
        if skip_first:
            endpoints = islice(endpoints, 1, None)
        for network_endpoint in endpoints:
            network_name = nname(map_name, network_endpoint.network_name)
            connect_kwargs = self.get_network_connect_kwargs(action, network_name, container_name, network_endpoint,
                                                             kwargs=kwargs)
            client.connect_container_to_network(**connect_kwargs)