<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def match_headers(self, entry, header_type, header, value, regex=True):
 """ Function to match headers. Since the output of headers might use different case, like: 'content-type' vs 'Content-Type' This function is case-insensitive :param entry: entry object :param header_type: ``str`` of header type. Valid values: * 'request' * 'response' :param header: ``str`` of the header to search for :param value: ``str`` of value to search for :param regex: ``bool`` indicating whether to use regex or exact match :returns: a ``bool`` indicating whether a match was found """

        if header_type not in entry:
            raise ValueError('Invalid header_type, should be either:\n\n'
                             '* \'request\'\n*\'response\'')

        # TODO - headers are empty in some HAR data.... need fallbacks here
        for h in entry[header_type]['headers']:
            if h['name'].lower() == header.lower() and h['value'] is not None:
                if regex and re.search(value, h['value'], flags=re.IGNORECASE):
                    return True
                elif value == h['value']:
                    return True
        return False