def check(self, instance, format):
if format not in self.checkers:<EOL><INDENT>return<EOL><DEDENT>func, raises = self.checkers[format]<EOL>result, cause = None, None<EOL>try:<EOL><INDENT>result = func(instance)<EOL><DEDENT>except raises as e:<EOL><INDENT>cause = e<EOL><DEDENT>if not result:<EOL><INDENT>raise FormatError(<EOL>"<STR_LIT>" % (instance, format), cause=cause,<EOL>)<EOL><DEDENT>
Check whether the instance conforms to the given format.

Arguments:

    instance (*any primitive type*, i.e. str, number, bool):

        The instance to check

    format (str):

        The format that instance should conform to


Raises:

    FormatError: if the instance does not conform to ``format``