def get_header(headers, name, default=None):
    """Return the value of header *name*.

    The *headers* argument must be a list of ``(name, value)`` tuples. If the
    header is found its associated value is returned, otherwise *default* is
    returned. Header names are matched case insensitively.
    """
    name = name.lower()
    for header in headers:
        if header[0].lower() == name:
            return header[1]
    return default
