import base64
import json


def encode_data(data):
    """Return a base64 encoded json dump."""
    encoded = base64.b64encode(
        json.dumps(data).encode('utf-8')
    )

    assert len(encoded) < 250 * 1024
    return encoded