def _check_for_missing_and_disallowed_fields(document, entries, fields):
 (missing_fields, disallowed_fields) = ([], [])
 for (field, in_votes, in_consensus, mandatory) in fields:
  if (mandatory and ((document.is_consensus and in_consensus) or (document.is_vote and in_votes))):
   if (field not in entries.keys()):
    missing_fields.append(field)
  elif ((document.is_consensus and (not in_consensus)) or (document.is_vote and (not in_votes))):
   if (field in entries.keys()):
    disallowed_fields.append(field)
 if missing_fields:
  raise ValueError(('Network status document is missing mandatory field: %s' % ', '.join(missing_fields)))
 if disallowed_fields:
  raise ValueError(("Network status document has fields that shouldn't appear in this document type or version: %s" % ', '.join(disallowed_fields)))

def _check_for_missing_and_disallowed_fields ( document , entries , fields ) : ( missing_fields , disallowed_fields ) = ( [ ] , [ ] ) for ( field , in_votes , in_consensus , mandatory ) in fields : if ( mandatory and ( ( document . is_consensus and in_consensus ) or ( document . is_vote and in_votes ) ) ) : if ( field not in entries . keys ( ) ) : missing_fields . append ( field ) elif ( ( document . is_consensus and ( not in_consensus ) ) or ( document . is_vote and ( not in_votes ) ) ) : if ( field in entries . keys ( ) ) : disallowed_fields . append ( field ) if missing_fields : raise ValueError ( ( 'Network status document is missing mandatory field: %s' % ', ' . join ( missing_fields ) ) ) if disallowed_fields : raise ValueError ( ( "Network status document has fields that shouldn't appear in this document type or version: %s" % ', ' . join ( disallowed_fields ) ) )
checks that we have mandatory fields for our type .