'Creates the NetFlow object.
fdesc: a file-like object or a filename
pcap_filter: a PCAP filter to use with nfdump'

def __init__(self, fdesc, pcap_filter=None):

    cmd = ['nfdump', '-aq', '-o', self.fmt]
    cmdkargs = {}
    if isinstance(fdesc, basestring):
        with open(fdesc) as fde:
            if (fde.read(2) not in utils.FileOpener.FILE_OPENERS_MAGIC):
                cmd.extend(['-r', fdesc])
            else:
                cmdkargs['stdin'] = utils.open_file(fdesc)
    else:
        cmdkargs['stdin'] = fdesc
    if (pcap_filter is not None):
        cmd.append(pcap_filter)
    super(NetFlow, self).__init__(cmd, cmdkargs)
