title: How do I specify multiple types for a parameter using type-hints?
body: <p>I have a Python function which accepts XML data as an <code>str</code>.</p>
  
  <p>For convenience, the function also checks for <code>xml.etree.ElementTree.Element</code> and will automatically convert to <code>str</code> if necessary.</p>
  
  <pre><code>import xml.etree.ElementTree as ET
  
  def post_xml(data: str):
      if type(data) is ET.Element:
          data = ET.tostring(data).decode()
      # ...
  </code></pre>
  
  <p>Is it possible to specify with type-hints that a parameter can be given as one of two types?</p>
  
  <pre><code>def post_xml(data: str or ET.Element):
      # ...
  </code></pre>