code: def payload_as_body(self, payload, **kw):
      msg = self._make_message()
      msg["From"] = "foo"
      msg["To"] = "bar"
      msg["Subject"] = "payload round trip test"
      msg.set_content(payload, **kw)
      b = bytes(msg)
      msg2 = message_from_bytes(b, policy=self.policy)
      self.assertEqual(bytes(msg2), b)
      self.assertEqual(msg2.get_content(), payload)
  
file_path: cpython/Lib/test/test_email/test_inversion.py
imports: import io
  import unittest
  from email import policy, message_from_bytes
  from email.message import EmailMessage
  from email.generator import BytesGenerator
  from test.test_email import TestEmailBase, parameterize
label_desc: Use image node_id 2 for calling the TestInversion obj's underlying member method code with example usage: obj.payload_as_body(payload) without return types