'Parse the cache control headers returning a dictionary with values
for the different directives.'

def parse_cache_control(self, headers):

    retval = {}
    cc_header = 'cache-control'
    if ('Cache-Control' in headers):
        cc_header = 'Cache-Control'
    if (cc_header in headers):
        parts = headers[cc_header].split(',')
        parts_with_args = [tuple([x.strip().lower() for x in part.split('=', 1)]) for part in parts if ((-1) != part.find('='))]
        parts_wo_args = [(name.strip().lower(), 1) for name in parts if ((-1) == name.find('='))]
        retval = dict((parts_with_args + parts_wo_args))
    return retval
