def assert_policy_shape(policy):
 errors = []
 if (policy['Version'] != '2012-10-17'):
  errors.append('Unknown version/date ({}) of policy. Things are probably different than we assumed they were.'.format(policy['Version']))
 found_statement_type = {}
 for statement in policy['Statement']:
  for (label, sidlabel) in statement_label.items():
   if (statement['Sid'] == sidlabel):
    found_statement_type[label] = True
 for statementtype in statement_label.keys():
  if (not found_statement_type.get(statementtype)):
   errors.append('Policy is missing {}.'.format(statementtype))
 if len(errors):
  raise Exception('Problems asserting policy shape. Cowardly refusing to modify it: {}'.format(' '.join(errors)))
 return None

def assert_policy_shape ( policy ) : errors = [ ] if ( policy [ 'Version' ] != '2012-10-17' ) : errors . append ( 'Unknown version/date ({}) of policy. Things are probably different than we assumed they were.' . format ( policy [ 'Version' ] ) ) found_statement_type = { } for statement in policy [ 'Statement' ] : for ( label , sidlabel ) in statement_label . items ( ) : if ( statement [ 'Sid' ] == sidlabel ) : found_statement_type [ label ] = True for statementtype in statement_label . keys ( ) : if ( not found_statement_type . get ( statementtype ) ) : errors . append ( 'Policy is missing {}.' . format ( statementtype ) ) if len ( errors ) : raise Exception ( 'Problems asserting policy shape. Cowardly refusing to modify it: {}' . format ( ' ' . join ( errors ) ) ) return None
since the policy seems a little .