def METHOD_NAME(self, expected, args,
        sep=NotDefined, end=NotDefined, file=NotDefined):
    # Capture sys.stdout in a StringIO.  Call print with args,
    #  and with sep, end, and file, if they're defined.  Result
    #  must match expected.
    # Look up the actual function to call, based on if sep, end, and file
    #  are defined
    fn = dispatch[(sep is not NotDefined,
                   end is not NotDefined,
                   file is not NotDefined)]
    with test_support.captured_stdout() as t:
        fn(args, sep, end, file)
    self.assertEqual(t.getvalue(), expected)