def _convert(value, conversion_function):
    """ Convert value using the optional conversion function. """
    if conversion_function is not None:
        value = conversion_function(value)
    return value