<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calc_cloud_connection(self):
 """ Add the ports and nios for a cloud connection :return: None on success or RuntimeError on error """

        # Connection String - SW1:1:nio_gen_eth:eth0
        # 0: Destination device 1: Destination port
        # 2: NIO 3: NIO Destination
        self.node['properties']['nios'] = []
        if self.connections is None:
            return None
        else:
            self.connections = self.connections.split(' ')

        for connection in sorted(self.connections):
            connection = connection.split(':')
            connection_len = len(connection)
            if connection_len == 4:
                nio = '%s:%s' % (connection[2], connection[3])
            elif connection_len == 6:
                nio = '%s:%s:%s:%s' % (connection[2].lower(), connection[3],
                                       connection[4], connection[5])
            else:
                return RuntimeError('Error: Unknown connection string length '
                                    '(Length: %s)' % connection_len)
            self.node['properties']['nios'].append(nio)
            # port entry
            self.node['ports'].append({'id': self.port_id,
                                       'name': nio,
                                       'stub': True})
            self.port_id += 1
            return None