import json


def fallback(reason=''):
    """Fallback response."""
    return dict(
        status_code=502,
        reason='Bad Gateway',
        headers={
            'Content-Type': 'application/json',
        },
        content=json.dumps({
            'code': 502,
            'message': str(reason) or 'gateway is using fallback mechanism',
            'errors': []
        })
    )