def exchange(self, pdu, timeout):
    if ((not isinstance(pdu, Symmetry)) or (self.cfg.get('symm-log') is True)):
        log.debug('SEND {0}'.format(pdu))
    data = (pdu.to_string() if pdu else None)
    try:
        data = self.mac.exchange(data, timeout)
        if (data is None):
            return None
    except nfc.clf.DigitalProtocolError as error:
        log.debug('{0!r}'.format(error))
        return None
    pdu = ProtocolDataUnit.from_string(data)
    if ((not isinstance(pdu, Symmetry)) or (self.cfg.get('symm-log') is True)):
        log.debug('RECV {0}'.format(pdu))
    return pdu
def exchange(self, pdu, timeout):
    if ((not isinstance(pdu, Symmetry)) or (self.cfg.get('symm-log') is True)):
        log.debug('SEND {0}'.format(pdu))
    data = (pdu.to_string() if pdu else None)
    try:
        data = self.mac.exchange(data, timeout)
        if (data is None):
            return None
    except nfc.clf.DigitalProtocolError as error:
        log.debug('{0!r}'.format(error))
        return None
    pdu = ProtocolDataUnit.from_string(data)
    if ((not isinstance(pdu, Symmetry)) or (self.cfg.get('symm-log') is True)):
        log.debug('RECV {0}'.format(pdu))
    return pdu