def check_headers(bucket, queue, verbose, dryrun):

    while True:
        try:
            key_name = queue.get(BLOCK_TIME)
        except:
            break

        if key_name == None:
            break

        key = bucket.lookup(key_name)

        if not key:
            print >> sys.stderr, "%s: Could not lookup" % key.name
            continue

        content_type = key.content_type
        expected_content_type, _ = mimetypes.guess_type(key.name)

        if not expected_content_type:
            print >> sys.stderr, "%s: Could not guess content type" % key.name
            continue

        if content_type == expected_content_type:
            if verbose:
                print "%s: Matches expected content type" % key.name
        else:
            print "%s: Current content type (%s) does not match expected (%s); fixing" % (key.name, content_type, expected_content_type)
            if not dryrun:
                key.copy(key.bucket, key.name, preserve_acl=True, metadata={'Content-Type': expected_content_type, 'Content-Disposition': key.content_disposition})
Callback used by sub-processes to check the headers of candidate files in
dataset/ETHPy150Open dailymuse/s3-content-type-fixer/s3_content_type_fixer.py/check_headers