def set_header_field(headers, name, value):
    """ Return new headers based on `headers` but with `value` set for the
    header field `name`.

    :param headers: the existing headers
    :type headers: list of tuples (name, value)

    :param name: the header field name
    :type name: string

    :param value: the value to set for the `name` header
    :type value: string

    :return: the updated headers
    :rtype: list of tuples (name, value)
    """
    dictheaders = dict(headers)
    dictheaders[name] = value
    return list(dictheaders.items())