def METHOD_NAME(headers, payload=None):
    msg = EmailMessage()
    for name, value in headers.items():
        if name == "_dependencies":
            for dep in value:
                if isinstance(dep, ExtraRequires):
                    msg["Provides-Extra"] = dep.name
                    for inner_dep in dep.deps:
                        msg["Requires-Dist"] = f"{inner_dep}; extra == '{dep.name}'"
                else:
                    msg["Requires-Dist"] = dep
        elif isinstance(value, list):
            for value_part in value:
                msg[name] = value_part
        else:
            msg[name] = value
    if payload:
        msg.set_payload(payload)
    return msg