def get_stack_value(stack, key):
    """Get metadata value from a cloudformation stack."""
    for output in stack.outputs:
        if output['OutputKey'] == key:
            return output['OutputValue']