code: def _get_payload(
      msg: email.message.Message, source: Union[bytes, str]
  ) -> str:
      """Get the body of the message."""
      # If our source is a str, then our caller has managed encodings for us,
      # and we don't need to deal with it.
      if isinstance(source, str):
          payload: str = msg.get_payload()
          return payload
      # If our source is a bytes, then we're managing the encoding and we need
      # to deal with it.
      else:
          bpayload: bytes = msg.get_payload(decode=True)
          try:
              return bpayload.decode("utf8", "strict")
          except UnicodeDecodeError:
              raise ValueError("payload in an invalid encoding")
  
file_path: catboost/contrib/python/setuptools/py3/setuptools/_vendor/packaging/metadata.py
imports: import email.feedparser
  import email.header
  import email.message
  import email.parser
  import email.policy
  import sys
  import typing
  from typing import Dict, List, Optional, Tuple, Union, cast
label_desc: Use image node_id 3 for calling a global function with example usage: _get_payload(msg, source) and returns: payload, bpayload