import base64


def make_data_url(mime_type, data):
    """Generate a `data:` URL from the given data and MIME type."""
    return "data:{0};base64,{1}".format(
        mime_type, base64.b64encode(data).decode('ascii'))