import base64
import json


def _encode_payload(data):
    """encodes the data dict into a base64 string
    Args:
        data: (dict) request data including (headers, body, query_params, path_params, http_method) keys
    Returns:
        (string) base64 string represting the passed data dict
    """
    return base64.b64encode(json.dumps(data).encode('utf-8')).decode('utf-8')