human
Complete this python program:
def file_contents(matcher):
assistant
#Here is the Python code you requested.

    """Match if a file\s contents match ``matcher``.
    For example::
    self.assertThat(
    FilePath(\/foo/bar/baz\),
    file_contents(Equals(\hello world\)))
    Will match if there is a file ``/foo/bar/baz`` and if its contents are
    exactly ``hello world``.
    """
    def get_content(file_path):
        return file_path.getContent()
    def content_mismatches(original):
        return mismatch(original.mismatched, ('%s    has    unexpected    contents:\n%s' % (original.mismatched.path, original.describe())), original.get_details())
    return MatchesAll(file_exists(), OnMismatch(content_mismatches, AfterPreprocessing(get_content, matcher, annotate=False)), first_only=True)