<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_ethsw_port(self, port_num, port_def):
 """ Split and create the port entry for an Ethernet Switch :param port_num: port number :type port_num: str or int :param str port_def: port definition """

        # Port String - access 1 SW2 1
        # 0: type 1: vlan 2: destination device 3: destination port
        port_def = port_def.split(' ')
        if len(port_def) == 4:
            destination = {'device': port_def[2],
                           'port': port_def[3]}
        else:
            destination = {'device': 'NIO',
                           'port': port_def[2]}
        # port entry
        port = {'id': self.port_id,
                'name': str(port_num),
                'port_number': int(port_num),
                'type': port_def[0],
                'vlan': int(port_def[1])}
        self.node['ports'].append(port)
        self.calc_link(self.node['id'], self.port_id, port['name'],
                       destination)
        self.port_id += 1