<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_targets_element(cls, scanner_target):
 """ Receive an XML object with the target, ports and credentials to run a scan against. @param: XML element with target subelements. Each target has <hosts> and <ports> subelements. Hosts can be a single host, a host range, a comma-separated host list or a network address. <ports> and <credentials> are optional. Therefore each ospd-scanner should check for a valid ones if needed. Example form: <targets> <target> <hosts>localhosts</hosts> <ports>80,443</ports> </target> <target> <hosts>192.168.0.0/24</hosts> <ports>22</ports> <credentials> <credential type="up" service="ssh" port="22"> <username>scanuser</username> <password>mypass</password> </credential> <credential type="up" service="smb"> <username>smbuser</username> <password>mypass</password> </credential> </credentials> </target> </targets> @return: A list of (hosts, port) tuples. Example form: [['localhost', '80,43'], ['192.168.0.0/24', '22', {'smb': {'type': type, 'port': port, 'username': username, 'password': pass, }}]] """


        target_list = []
        for target in scanner_target:
            ports = ''
            credentials = {}
            for child in target:
                if child.tag == 'hosts':
                    hosts = child.text
                if child.tag == 'ports':
                    ports = child.text
                if child.tag == 'credentials':
                    credentials = cls.process_credentials_elements(child)
            if hosts:
                target_list.append([hosts, ports, credentials])
            else:
                raise OSPDError('No target to scan', 'start_scan')

        return target_list