def test_decoder(obj):
    """Decode objects generated by the TestEncoder. Returns datetime object
    as string instead of datetime instances.
    """
    if '$dt' in obj:
        return obj['$dt']
    return obj