'Get all the details from the tag.'

def get_ndef_details(self, tag):

    details = {}
    try:
        details['uid'] = ':'.join(['{:02x}'.format((bt & 255)) for bt in tag.getId()])
        details['Technologies'] = tech_list = [tech.split('.')[(-1)] for tech in tag.getTechList()]
        ndefTag = cast('android.nfc.tech.Ndef', Ndef.get(tag))
        details['MaxSize'] = ndefTag.getMaxSize()
        details['writable'] = ndefTag.isWritable()
        ndefMesg = ndefTag.getCachedNdefMessage()
        details['consumed'] = len(ndefMesg.toByteArray())
        details['Type'] = ndefTag.getType()
        if (not ndefMesg):
            details['Message'] = None
            return details
        ndefrecords = ndefMesg.getRecords()
        length = len(ndefrecords)
        recTypes = []
        for record in ndefrecords:
            recTypes.append({'type': ''.join(map(unichr, record.getType())), 'payload': ''.join(map(unichr, record.getPayload()))})
        details['recTypes'] = recTypes
    except Exception as err:
        print str(err)
    return details
