def connect(self, obj, network):
        """Connect to the specified AP."""

        network_summary = self._send_cmd_to_wpas(
            obj['name'],
            'LIST_NETWORKS',
            True)
        network_summary = network_summary[:-1].split('\n')
        if len(network_summary) == 1:
            return networks

        for l in network_summary[1:]:
            values = l.split('\t')
            if values[1] == network.ssid:
                network_summary = self._send_cmd_to_wpas(
                    obj['name'],
                    'SELECT_NETWORK {}'.format(values[0]),
                    True)
Connect to the specified AP.