def _get_param_value(param, request):
    """Gets the value for the parameter.

    Args:
        param: a PipelineParameter instance describing the parameter
        request: the PipelineBuildRequest instance

    Returns:
        val: the parameter value
    """
    if param.param_str in request.parameters:
        # User-set parameter
        val = request.parameters[param.param_str]
    elif param.has_set_value:
        # Pipeline-set parameter
        val = param.set_value
    else:
        # Module-default value
        val = param.default_value

    return val