def decode(data):
    '''
    str -> bytes
    '''
    if riemann.network.CASHADDR_PREFIX is None:
        raise ValueError('Network {} does not support cashaddresses.'
                         .format(riemann.get_current_network_name()))
    if data.find(riemann.network.CASHADDR_PREFIX) != 0:
        raise ValueError('Malformed cashaddr. Cannot locate prefix: {}'
                         .format(riemann.netowrk.CASHADDR_PREFIX))

    # the data is everything after the colon
    prefix, data = data.split(':')
    decoded = b32decode(data)
    if not verify_checksum(prefix, decoded):
        raise ValueError('Bad cash address checksum')
    converted = convertbits(decoded, 5, 8)

    return bytes(converted[:-6])
str -> bytes