def build_speechlet_response(output, card_title=None, card_content=None, reprompt='',
                             should_end_session=True):
    """
    Contructs ``response`` dictionary with the proper struture to allow
    Alexa to talk to the user. Optionally takes ``card_title`` and
    ``card_content`` to build out a response viewable in the Alexa iOS
    or Android app.
    """
    response = {
        'outputSpeech': {
            'type': 'PlainText',
            'text': output
        },
        'reprompt': {
            'outputSpeech': {
                'type': 'PlainText',
                'text': reprompt
            }
        },
        'shouldEndSession': should_end_session
    }

    if card_title and card_content:
        response['card'] = {
            'type': 'Simple',
            'title': card_title,
            'content': card_content
        }

    return response