import json


def error_response(title, status='500'):
    """Generates an error response to return to API Gateway

    Parameters
    ----------
    title: string
        The title description of the error.
    status: string
        Thes http status code.
    
    Returns
    -------
    dict:
        An response back to the api gateway with the error.
    """
    return {
        'statusCode': '500',
        'body': json.dumps({
        'errors': [{
            'status': status,
            'title': title
        }]
    })}