def METHOD_NAME(base_pcap):
    # The parsing operation below assumes a specific file naming
    # convention trace_DeviceName-deviceID-time-duration-flags.pcap
    # Explanation: All files coming from Poseidon have trace_ at their
    # beginning. The device name and deviceID colums are self explanatory.
    # Time refers to the day of the week and time of day. Duration refers
    # to the length of the network traffic capture. The flags aspect
    # refers to an unknown characteristic.
    # TODO: tolerate tshark labels in the trace name, but do not parse them for now.
    pcap_key = None
    pcap_labels = None
    if base_pcap.startswith('trace_'):
        for pcap_re, key_pos, label_pos in (
                (re.compile(
                    r'^trace_([\da-f]+)_([0-9\_\-]+)-(client|server)-(.+).pcap$'), 1, 4),
                (re.compile(r'^trace_([\da-f]+)_([0-9\_\-]+).pcap$'), 1, None)):
            pcap_match = pcap_re.match(base_pcap)
            if pcap_match:
                pcap_key = pcap_match.group(key_pos)
                if label_pos:
                    pcap_labels = pcap_match.group(label_pos)
                break
    else:
        # Not a Poseidon trace file, return basename as key.
        pcap_key = base_pcap.split('.')[0]
    return (pcap_key, pcap_labels)