def METHOD_NAME(self, filename, contents):
    """creates the given file in the testdirectory with the given contents"""
    if isinstance(contents, str):
        contents = contents.encode("utf-8")
    testfile = self.open_testfile(filename, "wb")
    testfile.write(contents)
    testfile.close()