import base64


def _decode(elem):
    """ Modifies transaction data with decoded version """
    elem["tx_result"]["log"] = eval(elem["tx_result"]["log"])

    events = elem["tx_result"]["events"]
    for event in events:
        for kv in event["attributes"]:
            k, v = kv["key"], kv["value"]

            kv["key"] = base64.b64decode(k).decode()
            kv["value"] = base64.b64decode(v).decode()

    return elem