def is_valid_pre_6_2_version(xml):
    """Returns whether the given XML object corresponds to an XML output file of Quantum ESPRESSO pw.x pre v6.2

    :param xml: a parsed XML output file
    :return: boolean, True when the XML was produced by Quantum ESPRESSO with the old XML format
    """
    element_header = xml.find('HEADER')

    if element_header is None:
        return False

    element_format = element_header.find('FORMAT')

    if element_format is None:
        return False

    try:
        name = element_format.attrib['NAME']
    except KeyError:
        return False

    if name != 'QEXML':
        return False

    return True