def warn_attribs(loc,<EOL>node,<EOL>recognised_attribs,<EOL>reqd_attribs=None):
if reqd_attribs is None:<EOL><INDENT>reqd_attribs = recognised_attribs<EOL><DEDENT>found_attribs = set(node.keys())<EOL>if reqd_attribs - found_attribs:<EOL><INDENT>print(loc, '<STR_LIT>'.format(node.tag),<EOL>reqd_attribs - found_attribs)<EOL><DEDENT>if found_attribs - recognised_attribs:<EOL><INDENT>print(loc, '<STR_LIT>'.format(node.tag),<EOL>found_attribs - recognised_attribs)<EOL><DEDENT>
Error checking of XML input: check that the given node has certain
required attributes, and does not have any unrecognised
attributes.

Arguments:
- `loc`: a string with some information about the location of the
  error in the XML file
- `node`: the node to check
- `recognised_attribs`: a set of node attributes which we know how
  to handle
- `reqd_attribs`: a set of node attributes which we require to be
  present; if this argument is None, it will take the same value
  as `recognised_attribs`