<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def packet_xml(url_encoded_ivorn=None):
 """ Returns the XML packet contents stored for a given IVORN. The required IVORN should be appended to the URL after ``/xml/`` in :ref:`URL-encoded <url-encoding>` form. """

    # Handle Apache / Debug server difference...
    # Apache conf must include the setting::
    #   AllowEncodedSlashes NoDecode
    # otherwise urlencoded paths have
    # double-slashes ('//') replaced with single-slashes ('/').
    # However, the werkzeug simple-server decodes these by default,
    # resulting in differing dev / production behaviour, which we handle here.

    ivorn = validate_ivorn(url_encoded_ivorn)
    xml = db_session.query(Voevent.xml).filter(
        Voevent.ivorn == ivorn
    ).scalar()
    r = make_response(xml)
    r.mimetype = 'text/xml'
    return r