import base64


def to_base64(data):
    """
    Utility function to base64 encode.
    :param data: The data to encode.
    :return: The base64 encoded data.
    """
    return base64.b64encode(data)