import json


def response(code, message, error=None):
    """Format a standard API response body"""
    response_object = {
        'response_code': code,
        'message': message
        }
    if error:
        response_object['error'] = error
    return json.dumps(response_object)