def CheckEntitlements(file, expected_entitlements):
  with tempfile.NamedTemporaryFile() as temp:
    proc = subprocess.Popen(['codesign', '--display', '--entitlements',
                             temp.name, file], stdout=subprocess.PIPE)
    o = proc.communicate()[0].strip()
    assert not proc.returncode
    data = temp.read()
  entitlements = ParseEntitlements(data)
  if not entitlements:
    print 'No valid entitlements found in %s.' % (file)
    test.fail_test()
  if entitlements != expected_entitlements:
    print 'Unexpected entitlements found in %s.' % (file)
    test.fail_test()
dataset/ETHPy150Open adblockplus/gyp/test/ios/gyptest-per-config-settings.py/CheckEntitlements/original