code: def get_ports(self, scan_id, target):
          
          if target:
              for item in self.scans_table[scan_id]['targets']:
                  if target == item[0]:
                      return item[1]
  
          return self.scans_table[scan_id]['targets'][0][1]
docs: Get a scan's ports list. If a target is specified
          it will return the corresponding port for it. If not,
          it returns the port item of the first nested list in
          the target's list.